Edgewall Software
Modify

Opened 15 years ago

Last modified 9 years ago

#8727 new defect

cannot create TracLinks to attachments with number sign in file name

Reported by: jhn@… Owned by:
Priority: low Milestone: next-major-releases
Component: wiki system Version: 0.11.5
Severity: normal Keywords: needmajor, traclinks
Cc: jhn@…, itamarost@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

attachments with the number sign (#, also referred to as hash mark or pound sign) can be uploaded properly into trac, and the link generated in the Attachments section of the ticket works properly.

however, i cannot create TracLinks to the file.

attachment:attachment#1.txt

attachment:attachment#1.txt

attachment:'attachment#1.txt'

attachment:'attachment#1.txt'

[attachment:attachment#1.txt]

attachment#1.txt

[attachment:'attachment#1.txt']

attachment#1.txt

this is important for us because we document everything the client sends us, including file attachments, which sometimes come named with the number sign.

Attachments (1)

attachment#1.txt (1 byte ) - added by jhn@… 15 years ago.
example of file with number sign in its name

Download all attachments as: .zip

Change History (10)

by jhn@…, 15 years ago

Attachment: attachment#1.txt added

example of file with number sign in its name

comment:1 by Christian Boos, 15 years ago

Keywords: traclinks added
Milestone: next-minor-0.12.x

The following forms:

[attachment:'attachment#1.txt']
attachment:'attachment#1.txt'

have to be fixed.

comment:2 by Christian Boos, 15 years ago

Cc: itamarost@… added
Keywords: needmajor added
Milestone: next-minor-0.12.x0.12
Owner: set to Christian Boos

#9043 was closed as duplicate of this ticket. Indeed, this happens for any link resolver.

The fix for this is not immediately obvious, it might require quite some work and behavior change of the links (so that %\d\d sequences get recognized and unquoted at the proper time).

Tentatively putting back to 0.12.

comment:3 by Remy Blank, 15 years ago

This is indeed tricky. By the time the link data arrives in _format_link(), it has been unquoted, and it's not possible anymore to differentiate between "attachment#1.txt" and attachment#1.txt.

Then again, we currently don't support parameters and fragments for quoted links, e.g. attachment:"attachment.txt"?format=raw doesn't work, whereas attachment:attachment.txt?format=raw works (the fragment is stripped, though, probably an oversight).

I don't think that escaping and unescaping names at various locations is the right approach. How about changing the parser to accept the syntax ns:"resource_name"?params#fragment and splitting the parameters and fragment in Formatter._lhref_formatter() (and passing them to the link formatters), and if the link is unquoted, not consider any ? or # to be parameters or fragments? The result would be:

Linkidparamsfragment
attachment:attachment?param#1.txtattachment?param#1.txt
attachment:"attachment"?param#1.txtattachment?param#1.txt

The drawback is that it would break links like wiki:WikiStart?format=txt that currently work. That's probably unacceptable.

I'm going to try and find even another alternative.

comment:4 by Remy Blank, 15 years ago

Milestone: 0.12next-major-0.1X

There doesn't seem to be a simple, backward-compatible solution for this issue. So currently, the advice is "avoid using # in attachment names".

The non backward-compatible fix will be done in a next major version.

comment:5 by Christian Boos, 14 years ago

Priority: normallow

comment:6 by Ryan J Ollos, 11 years ago

Keywords: traclinks needmajor → traclinks, needmajor

comment:7 by Ryan J Ollos, 11 years ago

Keywords: traclink added; traclinks removed

comment:8 by Ryan J Ollos, 11 years ago

Keywords: traclinks added; traclink removed

comment:9 by Ryan J Ollos, 9 years ago

Owner: Christian Boos removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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