#6375 closed defect (fixed)
Attachment URLs Broken for Page with Embedded Spaces
| Reported by: | Owned by: | osimons | |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11 |
| Component: | attachment | Version: | devel |
| Severity: | minor | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
In r6153, a page with embedded blanks in the page title generates two different URL encodings for the page name in the "Edit Page" and "Attach File" forms.
In "Edit Page", %20 is used to indicate spaces. So, for example, the action for the edit form for "Page With Blanks" is
<form action="/wiki/Page%20with%20Blanks" method="get">
In "Attach Page", blank is replaced with %2520:
<form action="/attachment/wiki/Page%2520with%2520Blanks%3Fversion%3D1/" method="get">
Here's a diff for attachment.py that fixes it:
diff -c /usr/lib/python2.5/site-packages/Trac-0.11dev_r6153-py2.5.egg/trac/attachment.py.orig /usr/lib/python2.5/site-packages/Trac-0.11dev_r6153-py2.5.egg/trac/attachment.py
*** /usr/lib/python2.5/site-packages/Trac-0.11dev_r6153-py2.5.egg/trac/attachment.py.orig 2007-11-19 07:39:47.000000000 -0500
--- /usr/lib/python2.5/site-packages/Trac-0.11dev_r6153-py2.5.egg/trac/attachment.py 2007-11-19 16:50:58.000000000 -0500
***************
*** 466,474 ****
prefix = 'raw-attachment'
parent_href = get_resource_url(self.env, resource.parent, Href(''))
if not resource.id:
! return href(prefix, parent_href) + '/'
else:
! return href(prefix, parent_href, resource.id, **kwargs)
def get_resource_description(self, resource, format=None, **kwargs):
if format == 'compact':
--- 466,475 ----
prefix = 'raw-attachment'
parent_href = get_resource_url(self.env, resource.parent, Href(''))
if not resource.id:
! return href(prefix, unicode_unquote(parent_href)) + '/'
else:
! return href(prefix, unicode_unquote(parent_href),
! resource.id, **kwargs)
def get_resource_description(self, resource, format=None, **kwargs):
if format == 'compact':
Apologies in advance if this isn't the right way to report a bug/change.
Attachments (0)
Change History (4)
comment:1 by , 18 years ago
| Component: | wiki → attachment |
|---|---|
| Milestone: | → 0.11 |
| Severity: | normal → minor |
comment:2 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Fixed as part of [6241] - thanks for the report and patch identifying the location!
comment:3 by , 18 years ago
| Keywords: | fixowner added |
|---|
(adding fixowner keyword so that we can exercise the new workflow feature of fixing the owner without having to reopen the ticket once we're on 0.11beta1 here…)
comment:4 by , 17 years ago
| Keywords: | fixowner removed |
|---|---|
| Owner: | changed from to |



Replying to rottenchester@gmail.com:
Except from the fact that we prefer unified diffs (
diff -u), that's perfect!