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: | 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']
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)
Change History (10)
by , 15 years ago
Attachment: | attachment#1.txt added |
---|
comment:1 by , 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 , 15 years ago
Cc: | added |
---|---|
Keywords: | needmajor added |
Milestone: | next-minor-0.12.x → 0.12 |
Owner: | set to |
#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 , 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:
Link id params fragment attachment:attachment?param#1.txt
attachment?param#1.txt
attachment:"attachment"?param#1.txt
attachment
?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 , 15 years ago
Milestone: | 0.12 → next-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 , 14 years ago
Priority: | normal → low |
---|
comment:6 by , 11 years ago
Keywords: | traclinks needmajor → traclinks, needmajor |
---|
comment:7 by , 11 years ago
Keywords: | traclink added; traclinks removed |
---|
comment:8 by , 11 years ago
Keywords: | traclinks added; traclink removed |
---|
comment:9 by , 9 years ago
Owner: | removed |
---|
example of file with number sign in its name