Issue Details (XML | Word | Printable)

Key: MDL-17820
Type: Bug Bug
Status: Resolved Resolved
Resolution: Won't Fix
Priority: Minor Minor
Assignee: Petr Skoda
Reporter: Peter Chamberlin
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Lacking Apostrophe Support

Created: 08/Jan/09 06:59 PM   Updated: 08/Jan/09 10:42 PM
Return to search
Component/s: Files API
Affects Version/s: 1.9.3
Fix Version/s: None

File Attachments: 1. HTML File M2340001_C019-HSA1.Workshop.Health.and.Safety-Chemical.Paint.Remover.&.Air.Con'.Refrigerant.zip (352 kB)

Environment: Debian Linux
Issue Links:
Duplicate
 
Relates
 

Database: MySQL
Participants: Peter Chamberlin and Petr Skoda
Security Level: None
Difficulty: Easy
Resolved date: 08/Jan/09
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
If I upload a SCORM package containing an apostrophe in its name then the "Choose or Upload File..." pop-up window prevents me from selecting it with the "Choose" link due to JavaScript error (basic string handling fault). If I enter the name of the SCORM package myself manually in the Package file field then attempting to import it results in another failure claiming invalid manifest or corrupt file. If I rename the package to exclude the apostrophe the import works normally.

Apostrophes within filenames are supported in Windows FAT32, NTFS and virtually all Linux file systems.

See attached SCORM 1.2 package for test case (351 kB).

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Petr Skoda added a comment - 08/Jan/09 07:31 PM
Sorry, we are not going to support characters like "':|<>&? etc in file names. It is not just about allowing them, we would need to review all main code base and contrib and fix the code.

Peter Chamberlin added a comment - 08/Jan/09 07:39 PM
I am not suggesting you support reserved OS filename characters, just the humble apostrophe and only in those two cases!

The first is simple, the inline HTML contains:

<a onclick="return set_value('AC Circuits/M2012601_C001-D3000.1.2.-.AC.Circuits-Sinusoidal.Alternating.Waveforms.zip')" href="#">Choose</a>

However, when the apostrophe is there the JavaScript string becomes syntactically invalid. All that needs to be done is to replace apostrophes in the string with their escaped form of \' (in this case).


Petr Skoda added a comment - 08/Jan/09 07:46 PM
it should not be possible to upload a file with ' in its name, the only way should to extract zip package using platform infozip binary, going to test your file now

Petr Skoda added a comment - 08/Jan/09 07:48 PM
did you ftp the file to server, or how did you get it there? When I uploaded it the ' was removed (M2340001_C019-HSA1.Workshop.Health.and.Safety-Chemical.Paint.Remover..Air.Con.Refrigerant.zip).

Peter Chamberlin added a comment - 08/Jan/09 08:03 PM
The files were FTP'd to the server (since there is 162 of them)

When I try importing the example package I receive the error:
"The specified package/manifest is not valid. Check it and try again."

Our Moodle instance is 1.9.3+ (Build: 20081217)


Peter Chamberlin added a comment - 08/Jan/09 09:19 PM
No mention of apostrophe as a reserved file name character at:
http://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words

Petr Skoda added a comment - 08/Jan/09 10:14 PM
I does not matter if they are mentioned, our problems were XSS caused by " or ' in file names/directories - very many devs are forgetting to urlencode/decode them properly.

Peter Chamberlin added a comment - 08/Jan/09 10:18 PM
That sounds to me more like a problem with the developers than the apostrophe

Petr Skoda added a comment - 08/Jan/09 10:42 PM
The question is who is going to fix all the developers :-D