attachments download url not encode #3136

Closed
opened 2025-11-02 05:01:45 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @TimmyOVO on GitHub (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

Originally created by @TimmyOVO on GitHub (Apr 4, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.8 - Git version: 2.19.1.windows - Operating system: Windows10 1809 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (https://try.gitea.io/TimmyOVO/Test/releases) - [ ] No - [ ] Not relevant - Log gist: ## 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](https://i.loli.net/2019/04/04/5ca5b772b4ac1.png) ![PIC2](https://i.loli.net/2019/04/04/5ca5b8729d975.png) <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/bug label 2025-11-02 05:01:45 -06:00
Author
Owner

@zeripath commented on GitHub (Apr 4, 2019):

sigh

The error is here:

d3dc07f282/templates/repo/release/list.tmpl (L80)

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 commented on GitHub (Apr 4, 2019): _sigh_ The error is here: https://github.com/go-gitea/gitea/blob/d3dc07f282936849897f861346777b47c8c388d3/templates/repo/release/list.tmpl#L80 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?
Author
Owner

@zeripath commented on GitHub (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.

@zeripath commented on GitHub (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.
Author
Owner

@mrsdizzie commented on GitHub (Apr 4, 2019):

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 commented on GitHub (Apr 4, 2019): Sure I'll make a PR for this (that suggestion above seems right, seems somebody just forgot to do any escaping on this part).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3136