Ticket #46 (closed defect: fixed)

Opened 6 years ago

Last modified 15 months ago

Files handler bug with filenames containing a space

Reported by: DarTar Owned by: BrianKoontz
Priority: normal Milestone: 1.3.1
Component: handlers Version: 1.1.6.0
Severity: normal Keywords:
Cc:

Description (last modified by DarTar) (diff)

Files handler: if the filename contains a space, Moz/FF will show only the first word in the download dialog; filename should be enclosed in quotes.

Thanks to MrTrick for pointing out this problem It is possible to upload files with a space in the file name. However, when trying to download such a file things don't work as expected: in Mozilla browsers (Mozilla, Firefox, etc.) the suggested filename for the download is truncated at the first space. Two possible solutions:

  1. Prevent that file names are stored with spaces in the name; simply replacing all spaces with underscores would do the trick and keep the file name recognizable. This has the advantage that no assumptions are being made about the server OS or the user's OS as to whether spaces in file names are valid.
  2. Mozilla seems to pick up the suggested file name from the Content-Disposition header. (raw)urlencoding the file name here works, but then displays the name with the encoding; enclosing the file name in (double) quotes works better, showing the full file name with spaces. This has the advantage that the original file name is preserved - provided both the server OS and the downloading user's OS can handle such file names.

Take your pick ;-) -- JavaWoman

Related tickets

#72 #89

Attachments

filespace.patch Download (3.5 KB) - added by BrianKoontz 6 years ago.
Patch that permits embedded ws and other special chars in filenames

Change History

Changed 6 years ago by dartar

  • milestone changed from 1.1.6.1 to 1.1.6.2

Changed 6 years ago by dartar

  • description modified (diff)

Changed 6 years ago by DarTar

  • description modified (diff)
  • reporter changed from dartar to DarTar

Changed 6 years ago by DarTar

  • description modified (diff)

Changed 6 years ago by DarTar

  • milestone changed from 1.1.6.2 to 1.1.6.3

moving to 1.1.6.3 for speeding up the release of 1.1.6.2

Changed 6 years ago by BrianKoontz

  • owner changed from unassigned to BrianKoontz
  • status changed from new to assigned

The problem with urlencode() is that it embeds a '+' symbol, which is a perfectly legitimate character in a filename. urldecode() doesn't know whether the '+' symbol is a real '+' or just a space. So I've attached a patch that saves the file using rawurlencode(), replacing ws with %20, wraps the Content-Disposition filename in quotes so Mozilla and family can figure out what to do with it, and makes sure the file displays with the original ws. It shouldn't really matter to the user what the stored filename looks like.

I've tested with filenames with embedded ws and embedded + symbols; uploads, deletions, and downloads all work as expected.

Changed 6 years ago by BrianKoontz

Patch that permits embedded ws and other special chars in filenames

Changed 5 years ago by BrianKoontz

  • status changed from assigned to closed
  • resolution set to fixed

Changed 5 years ago by BrianKoontz

Closed in [257]. Properly encoded/decodes embedded non-alphanum characters in filenames.

Changed 3 years ago by DarTar

  • milestone changed from 1.2 to 1.3

Retargeting to 1.3, this ticket has already been closed in trunk, from which 1.3 will be branched. Consider backporting urgent issues to 1.2.X

Changed 15 months ago by BrianKoontz

  • milestone changed from 1.3 to 1.3.1

Updated milestone to 1.3.1

Note: See TracTickets for help on using tickets.