Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attachments download url not encode #6506

Closed
2 of 7 tasks
TimmyOVO opened this issue Apr 4, 2019 · 3 comments · Fixed by #6512
Closed
2 of 7 tasks

attachments download url not encode #6506

TimmyOVO opened this issue Apr 4, 2019 · 3 comments · Fixed by #6512
Labels
Milestone

Comments

@TimmyOVO
Copy link

TimmyOVO commented Apr 4, 2019

Description

https://try.gitea.io/TimmyOVO/Test/releases/download/Test/test#abc.jpg
not working but when url encoded
https://try.gitea.io/TimmyOVO/Test/releases/download/Test/test%23abc.jpg
its work
...

Screenshots

PIC1
PIC2

@zeripath
Copy link
Contributor

zeripath commented Apr 4, 2019

sigh

The error is here:

<a target="_blank" rel="noopener noreferrer" href="{{$.RepoLink}}/releases/download/{{$release.TagName}}/{{$attachment.Name}}">

There are multiple uses of EscapePound elsewhere in that file - I am very suspicious that some of these may not be correct, but I am not certain that they're wrong and would require looking at the source code in depth, which I cannot do here.

Paging @mrsdizzie: fancy a quick fix?

@zeripath
Copy link
Contributor

zeripath commented Apr 4, 2019

@TimmyOVO if you want to send a PR, Changing line 80 of templates/repo/release/list.tmpl from:

 <a target="_blank" rel="noopener noreferrer" href="{{$.RepoLink}}/releases/download/{{$release.TagName}}/{{$attachment.Name}}"> 

to:

 <a target="_blank" rel="noopener noreferrer" href="{{$.RepoLink}}/releases/download/{{$release.TagName | PathEscape }}/{{$attachment.Name | PathEscape}}"> 

Although another option is to rationalise this endpoint so that it does a similar thing to endpoints that use EscapePound elsewhere.

@lunny lunny added the type/bug label Apr 4, 2019
@mrsdizzie
Copy link
Member

Sure I'll make a PR for this (that suggestion above seems right, seems somebody just forgot to do any escaping on this part).

mrsdizzie added a commit to mrsdizzie/gitea that referenced this issue Apr 4, 2019
Make sure file attachments on a release get a properly escaped URL when
linking.

Fixes go-gitea#6506
techknowlogick pushed a commit that referenced this issue Apr 5, 2019
Make sure file attachments on a release get a properly escaped URL when
linking.

Fixes #6506
mrsdizzie added a commit to mrsdizzie/gitea that referenced this issue Apr 5, 2019
Make sure file attachments on a release get a properly escaped URL when
linking.

Fixes go-gitea#6506
techknowlogick pushed a commit that referenced this issue Apr 5, 2019
Make sure file attachments on a release get a properly escaped URL when
linking.

Fixes #6506
@lafriks lafriks added this to the 1.8.0 milestone Apr 5, 2019
6543 added a commit to 6543-forks/gitea that referenced this issue Dec 28, 2019
* before only first got downloaded - now each is downloadable
* dos also take care of  go-gitea#6506 (fix was: go-gitea#6512)
zeripath pushed a commit that referenced this issue Dec 28, 2019
* Handle if two or more attachments have the same name
* previously only the first could be downloaded - now each is downloadable
* dos also take care of  #6506 (fix was: #6512)
* use func DownloadURL() at issue attatchments too
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants