Edgewall Software
Modify

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#9997 closed defect (invalid)

Browser fails to access files or directories with spaces

Reported by: Jordi Mallach Owned by:
Priority: normal Milestone:
Component: version control/browser Version: 0.12.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I've noticed our 0.12.1 install is unable to browse to directories with spaces in their filename, or show the content of files with spaces in their filename.

We have a good list of plugins installed, but I don't think any of them tamper with browser functionality.

I've created a new repo and a new trac env, and can reproduce this with ease. Except of my DEBUG log:

Trac[migrate_test:main] DEBUG: Dispatching <Request "GET '/browser'">
Trac[migrate_test:session] DEBUG: Retrieving session for ID 'jordi'
Trac[migrate_test:main] DEBUG: Negotiated locale: en-GB -> en_GB
Trac[migrate_test:api] INFO: Synchronized '' repository in 0.01 seconds
Trac[migrate_test:chrome] DEBUG: Prepare chrome data for request
Trac[migrate_test:perm] DEBUG: No policy allowed jordi performing BLOG_VIEW on None
Trac[migrate_test:main] DEBUG: Dispatching <Request "GET '/browser/default'">
Trac[migrate_test:session] DEBUG: Retrieving session for ID 'jordi'
Trac[migrate_test:main] DEBUG: Negotiated locale: en-GB -> en_GB
Trac[migrate_test:api] INFO: Synchronized '' repository in 0.01 seconds
Trac[migrate_test:chrome] DEBUG: Prepare chrome data for request
Trac[migrate_test:perm] DEBUG: No policy allowed jordi performing BLOG_VIEW on None
Trac[migrate_test:main] DEBUG: Dispatching <Request "GET '/browser/default/test%20with%20spaces'">
Trac[migrate_test:session] DEBUG: Retrieving session for ID 'jordi'
Trac[migrate_test:main] DEBUG: Negotiated locale: en-GB -> en_GB
Trac[migrate_test:api] INFO: Synchronized '' repository in 0.01 seconds
Trac[migrate_test:chrome] DEBUG: Prepare chrome data for request
Trac[migrate_test:perm] DEBUG: No policy allowed jordi performing BLOG_VIEW on None
Trac[migrate_test:main] WARNING: HTTPNotFound: 404 Trac error (<p class="message">No node test%20with%20spaces at revision 3</p><p>You can <a href="/trac/migrate_test/log/test%2520with%2520spaces?rev=3&amp;mode=path_history">search</a> in the repository history to see if that path existed but was later removed</p>)
Trac[migrate_test:main] DEBUG: Dispatching <Request "GET '/browser/default/hola'">
Trac[migrate_test:session] DEBUG: Retrieving session for ID 'jordi'
Trac[migrate_test:main] DEBUG: Negotiated locale: en-GB -> en_GB
Trac[migrate_test:api] INFO: Synchronized '' repository in 0.01 seconds
Trac[migrate_test:chrome] DEBUG: Prepare chrome data for request
Trac[migrate_test:perm] DEBUG: No policy allowed jordi performing BLOG_VIEW on None
Trac[migrate_test:main] DEBUG: Dispatching <Request "GET '/browser/default/hola/file%20with%20spaces'">
Trac[migrate_test:session] DEBUG: Retrieving session for ID 'jordi'
Trac[migrate_test:main] DEBUG: Negotiated locale: en-GB -> en_GB
Trac[migrate_test:api] INFO: Synchronized '' repository in 0.01 seconds
Trac[migrate_test:chrome] DEBUG: Prepare chrome data for request
Trac[migrate_test:perm] DEBUG: No policy allowed jordi performing BLOG_VIEW on None
Trac[migrate_test:main] WARNING: HTTPNotFound: 404 Trac error (<p class="message">No node hola/file%20with%20spaces at revision 3</p><p>You can <a href="/trac/migrate_test/log/hola/file%2520with%2520spaces?rev=3&amp;mode=path_history">search</a> in the repository history to see if that path existed but was later removed</p>)

The repo can be accessed perfectly via the SVN client. Subversion is at 1.6.12 (Debian squeeze).

Attached is a dump of the repo, but nothing too interesting there: just a dir and a file with spaces.

Attachments (1)

migrate_test.db (1.2 KB ) - added by Jordi Mallach 13 years ago.
Dump of a minimal SVN repo that triggers this

Download all attachments as: .zip

Change History (6)

by Jordi Mallach, 13 years ago

Attachment: migrate_test.db added

Dump of a minimal SVN repo that triggers this

comment:1 by Christian Boos, 13 years ago

This is most probably related to your web front-end, tell us more about your setup.

Are you proxying from fastcgi to tracd via flup by any chance? If so, you should try the -q parameter (see TracStandalone#Usingtracdbehindaproxy).

comment:2 by Jordi Mallach, 13 years ago

The following patch "fixes" this for me:

  • svn_fs.py

    old new  
    4646import os.path
    4747import weakref
    4848import posixpath
     49import urllib
    4950
    5051from trac.config import ListOption
    5152from trac.core import *
     
    8182    x = core.svn_path_canonicalize('/'.join(args).lstrip('/')
    8283                                                    .encode('utf-8'),
    8384                                      pool)
     85    return urllib.unquote(x)
    8486
    8587def _from_svn(path):
    8688    """Expect an UTF-8 encoded string and transform it to an `unicode` object

The problem is that svn expects to get the request as an unquoted URL. Adding this call, the request is done correctly — but you get the space quoting in the printed url (in the body and title of the page). (the url that your browser shows will be ok though):

 source: default/test%20with%20spaces @ 2 

Now, besides the aesthetics of this solution (which needs fix), I have no clue of the security implications that unquoting the url might bring. I leave that to the Trac experts. :)

in reply to:  1 comment:3 by Jordi Mallach, 13 years ago

Resolution: invalid
Status: newclosed

Replying to cboos:

This is most probably related to your web front-end, tell us more about your setup.

Are you proxying from fastcgi to tracd via flup by any chance? If so, you should try the -q parameter (see TracStandalone#Usingtracdbehindaproxy).

As usual, you hit the nail right on the head. Our setup is based on a nginx frontend for all the chrome stuff, so yep, we were missing this argument.

Thanks a lot Christian!

comment:4 by Christian Boos, 13 years ago

You're welcome!

Yep, the problem sounded familiar and I was sure that we normally support white spaces in browser paths ;-)

Please don't hesitate to improve the nginx related documentation (TracFastCgi, TracNginxRecipe), this is a grey area for me as I've never used that particular configuration.

comment:5 by Jordi Mallach, 13 years ago

I see we can do some contributions to the authentication section. I'll see if I can devote some work time for that, I'm sure my boss wouldn't have a problem.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.