Edgewall Software
Modify

Opened 12 years ago

Last modified 8 months ago

#10801 new defect

Can't download attached file when filename contain 'space'.

Reported by: buaa.byl@… Owned by:
Priority: low Milestone: next-stable-1.6.x
Component: attachment Version: 0.12.3
Severity: normal Keywords: verify
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

First I attache a file "processor reference.pdf" to wiki. Then I found the filename save to disk is "processor%20reference.pdf".

And url from wiki is "http://127.0.0.1:8008/trac/knowledge/attachment/wiki/instruction_of_picoblaze/processor%20reference.pdf"

but I can not download it, browser show '404 not found' when I click it.

When I rename the filename from "processor%20reference.pdf" to "processor reference.pdf".

Then I clkick url, the url is valid, I can download it.

So, maybe it is a bug?

I use version 0.12.3 of trac and browser is opera.

Attachments (2)

filename with spaces.pdf (4 bytes ) - added by Christian Boos 12 years ago.
dummy file
filename%20with%20spaces.pdf (4 bytes ) - added by Christian Boos 12 years ago.
another dummy file… this time with no spaces but actual "%20" sequences of 3 characters

Download all attachments as: .zip

Change History (17)

comment:1 by Christian Boos, 12 years ago

If you're using tracd behind another web server, then please have a look at TracStandalone#Usingtracdbehindaproxy.

in reply to:  1 comment:2 by buaa.byl@…, 12 years ago

Replying to cboos:

If you're using tracd behind another web server, then please have a look at TracStandalone#Usingtracdbehindaproxy.

I use apache2.2.17 + mod_wsgi3.3, not tracd.

by Christian Boos, 12 years ago

Attachment: filename with spaces.pdf added

dummy file

by Christian Boos, 12 years ago

another dummy file… this time with no spaces but actual "%20" sequences of 3 characters

comment:3 by Christian Boos, 12 years ago

The above attachment contains real spaces in its filename. Now try to download it using:

http://trac.edgewall.org/attachment/ticket/10801/filename%20with%20spaces.pdf

… it works, at least in FF. This is a browser "feature" I suppose.

If the file would really contain the "%20" sequence of characters, we would need to double encode it:

http://trac.edgewall.org/attachment/ticket/10801/filename%2520with%2520spaces.pdf

comment:4 by buaa.byl@…, 12 years ago

I can download your "filename with spaces.pdf" from chrome/IE/firefox/opera.

But my file still can't download with neither chrome/IE/firefox/opera. http://127.0.0.1:8008/trac/knowledge/raw-attachment/wiki/instruction_of_picoblaze/PicoBlaze%20Intructions.xlsx

Every browser response"The requested URL /trac/knowledge/raw-attachment/wiki/instruction_of_picoblaze/PicoBlaze Intructions.xlsx was not found on this server.".

If I rename the file from PicoBlaze%20Instructions.xlsx to PicoBlaze Instruction.xlsx, then I can download http://127.0.0.1:8008/trac/knowledge/raw-attachment/wiki/instruction_of_picoblaze/PicoBlaze%20Intructions.xlsx

from every browser.

But http://127.0.0.1:8008/trac/knowledge/attachment/wiki/instruction_of_picoblaze/PicoBlaze%20Intructions.xlsx response Attachment 'PicoBlaze Intructions.xlsx' not found

I upload a file name test out.txt, I can view in preview, but still can't download in Original Format.

comment:5 by buaa.byl@…, 12 years ago

By the way, file contant space can download after attach to a ticket:) This problem just appear in wiki attachment.

in reply to:  3 ; comment:6 by Christian Boos, 12 years ago

(forgot to finish my example, will go back to what has been added in comment:5 a bit later …)

In fact it's probably not browser specific, as the other browsers I tested behave the same.

Anyway, we already do this double encoding, as you can see from the Attachments links above and from those generated by the TracLinks syntax:

 - [attachment:filename%20with%20spaces.pdf]
 - [attachment:"filename with spaces.pdf"]

in reply to:  6 comment:7 by Christian Boos, 12 years ago

Replying to buaa.byl@…:

By the way, file contant space can download after attach to a ticket:) This problem just appear in wiki attachment.

Could you try with demo-0.13/wiki/Testing10801?

comment:8 by buaa.byl@…, 12 years ago

Both ie and chrome can download two attachment from demo-0.13/wiki/Testing10801.

comment:9 by Christian Boos, 12 years ago

So, to summarize, if in your Trac, you have the following URL:
http://127.0.0.1:8008/trac/knowledge/attachment/wiki/instruction_of_picoblaze/processor%20reference.pdf
but the filename of that attachment is processor%20reference.pdf, then it's normal that you can't access the file in this case, as this URL refers to the file named processor reference.pdf.

This is the same as what you can see here, with the URL:
http://trac.edgewall.org/demo-0.13/attachment/wiki/Testing10801/filename%20with%20spaces.pdf
which refers to filename with spaces.pdf (and not to filename%20with%20spaces.pdf).

So the question is, what generates the URL ending with "…/processor%20reference.pdf" on your system?

  • does that really come from the list of attachments found in your instruction_of_picoblaze wiki page, as your comment:5 imply? Please show us the relevant HTML excerpt, as that would seem to contradict what can be seen in demo-0.13/wiki/Testing10801 (or even demo-0.12/wiki/Testing10801).
  • or does that URL come from an [attachment:...] TracLinks? Maybe you wrote [attachment:processor%20reference.pdf]?
  • by any chance, do you use a plugin that could mess with the list of attachments? Try disabling temporarily your plugins, just to be sure.

in reply to:  9 comment:10 by buaa.byl@…, 12 years ago

Replying to cboos:

So, to summarize, if in your Trac, you have the following URL:
http://127.0.0.1:8008/trac/knowledge/attachment/wiki/instruction_of_picoblaze/processor%20reference.pdf
but the filename of that attachment is processor%20reference.pdf, then it's normal that you can't access the file in this case, as this URL refers to the file named processor reference.pdf.

This is the same as what you can see here, with the URL:
http://trac.edgewall.org/demo-0.13/attachment/wiki/Testing10801/filename%20with%20spaces.pdf
which refers to filename with spaces.pdf (and not to filename%20with%20spaces.pdf).

So the question is, what generates the URL ending with "…/processor%20reference.pdf" on your system?

  • does that really come from the list of attachments found in your instruction_of_picoblaze wiki page, as your comment:5 imply? Please show us the relevant HTML excerpt, as that would seem to contradict what can be seen in demo-0.13/wiki/Testing10801 (or even demo-0.12/wiki/Testing10801).
  • or does that URL come from an [attachment:...] TracLinks? Maybe you wrote [attachment:processor%20reference.pdf]?
  • by any chance, do you use a plugin that could mess with the list of attachments? Try disabling temporarily your plugins, just to be sure.

I have two trac system, one is in my pc, the other is in company.

  • Trac on my pc is Windows7 + apache2.2.22 + mod_wsgi3.3 + python2.7.2 + php5.4,issue on this.
  • Trac on company is Debian5 + apache2.2.9 + mod_wsgi3.3 + python2.5.2 + php5.2.

And I test like that : attach a file named "test space.txt" to WikiStart, and click the bottom atachment list, and click "test space.txt", both two system can preview file, then I click origianl format, trac on windows show The requested URL /trac/public/raw-attachment/wiki/WikiStart/test space.txt was not found on this server., and trac on debian5 is ok.

And both file name in disk is /trac/tracpool/public/attachments/wiki/WikiStart/test%20space.txt and Apache\trachome\public\attachments\wiki\WikiStart\test%20space.txt

comment:11 by Christian Boos, 12 years ago

Keywords: verify added
Milestone: next-stable-1.0.x

Ok, I guess I need to see by myself…

comment:12 by Ryan J Ollos, 11 years ago

Summary: Can't download attache file when filename contain 'space'.Can't download attached file when filename contain 'space'.

comment:13 by Ryan J Ollos, 7 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

comment:14 by Ryan J Ollos, 4 years ago

Milestone: next-stable-1.2.xnext-stable-1.4.x

comment:15 by Ryan J Ollos, 8 months ago

Milestone: next-stable-1.4.xnext-stable-1.6.x

Milestone renamed

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.