Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#6375 closed defect (fixed)

Attachment URLs Broken for Page with Embedded Spaces

Reported by: rottenchester@… 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)

in reply to:  description comment:1 by Christian Boos, 16 years ago

Component: wikiattachment
Milestone: 0.11
Severity: normalminor

Replying to rottenchester@gmail.com:

Apologies in advance if this isn't the right way to report a bug/change.

Except from the fact that we prefer unified diffs (diff -u), that's perfect!

comment:2 by osimons, 16 years ago

Resolution: fixed
Status: newclosed

Fixed as part of [6241] - thanks for the report and patch identifying the location!

comment:3 by Christian Boos, 16 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 Christian Boos, 15 years ago

Keywords: fixowner removed
Owner: changed from Christian Boos to osimons

Modify Ticket

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