Edgewall Software

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#11395 closed enhancement (fixed)

Replace unicode control codes with spaces in attachment filename — at Version 4

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.3
Component: attachment Version:
Severity: normal Keywords: unicode control codes
Cc: Ryan J Ollos Branch:
Release Notes:

Unicode control codes are replaced with spaces in attachment filenames.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

It was discussed on the mailing list that control codes in attachment filename should be replaced with whitespaces.

Change History (4)

comment:1 by Ryan J Ollos, 10 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 10 years ago

As mentioned on the mailing list, the following behaviors are seen:

  • In Chrome the control code will be url-encoded
  • In Firefox the control code will be replaced with whitespace
  • In Opera an error will be issued that the file can't be found

Even with the patch, the browser will have the first chance to modify the filename. So as far as I can tell, if we implement some behavior in AttachmentModule._do_save to replace control codes with whitespace, it will really only help in the case that there are some browsers that pass along the filename with the control-codes still present.

The following case was also mentioned on the mailing list:

$ echo "good day!" > "file
"
trac-admin ../tracdev attachment add wiki:WikiStart "file
"

When trying to view the file through the browser we get: No handler matched request to /attachment/wiki/WikiStart/file1 .txt.

I'm more convinced that this is hardly worth worrying about, but might something like the following work well?: log:rjollos.git:t11395

I don't understand everything that is going on inside of _normalized_filename, but at least we can easily write unit tests for it, and it might be appropriate for trac.util.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

comment:3 by Ryan J Ollos, 10 years ago

Milestone: next-stable-1.0.x1.0.3
Owner: set to Ryan J Ollos
Status: newassigned

comment:4 by Ryan J Ollos, 9 years ago

Milestone: 1.0.31.1.3
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

It seemed least risky to finally push this to the trunk. Committed in [13603].

Note: See TracTickets for help on using tickets.