Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#6992 closed defect (fixed)

Spaces not accepted in file names under htdocs

Reported by: anonymous Owned by: Christopher Lenz
Priority: normal Milestone: 0.11
Component: web frontend/mod_python Version: devel
Severity: blocker Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Problem: Trac does not allow spaces in files located in htdocs.

Cause: the method match_request() in trunk/trac/web/chrome.py has a regexp that filters the file name but stops at the first occurence of a space, thus a link to htdocs:File 1.jpg becomes /chrome/site/File instead of /chrome/site/File 1.jpg. The URL is being escaped by the browser, but gets unescaped by trac before it hits match_request().

Suggested fixes:

  • Allow spaces by extending the regular expression or
  • Prohibit spaces (in alignment with wiki page names), but throw an according error message (along the lines of "No spaces allowed in files").

The first solution has the problem that spaces need to be escaped with %20 manually in wiki links, since htdocs:File 1.jpg will yield "1.jpg" (1.jpg being interpreted as a description and File%201.jpg looks ugly).

Attachments (1)

allow_spaces_in_files.patch (530 bytes ) - added by danimo 17 years ago.
Suggested fix

Download all attachments as: .zip

Change History (6)

comment:1 by danimo, 17 years ago

Summary: Spaces not accepted in file names underhtdocsSpaces not accepted in file names under htdocs

comment:2 by Tim Hatch, 17 years ago

Actually there is syntax for allowing spaces in wikilinks… htdocs:"File 1.jpg"

in reply to:  2 comment:3 by anonymous, 17 years ago

Replying to thatch:

Actually there is syntax for allowing spaces in wikilinks… htdocs:"File 1.jpg"

Interesting, thanks. Unfortunally that doesn't solve the problem itself. So we still need to know how to go about this.

by danimo, 17 years ago

Attachment: allow_spaces_in_files.patch added

Suggested fix

comment:4 by danimo, 17 years ago

The above patch was suggested by cmlenz and thatch and tested by me. It solves this issue. Please apply.

comment:5 by John Hampton, 17 years ago

Resolution: fixed
Status: newclosed

Patch applied in [6736]. Thanks danimo

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.