Release downloads should trigger a download #12312

Closed
opened 2025-11-02 10:05:17 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @AsgeirSH on GitHub (Jan 8, 2024).

Description

Overview

When downloading files from a release that contains files that browsers can open (for example a .hex-file), Gitea does not trigger a download.

Instead, the file is opened in a new tab and when manually saving the content, the file type is not preserved and is instead suggested to be saved as .txt.

Expected behavior

When clicking to download a file from a release, Gitea should set the proper headers to ensure that the browser will suggest to save it with the same filename and extension as in the released file.

This works as expected when clicking the Download-button in the Code view.

Example

Reproduced on the demo site: https://try.gitea.io/AsgeirSH/DownloadFileIssueRepro/releases/tag/v0.0.1

Suggested fix

Adding a download attribute in the <a>-tag for the file. When this is added by manually editing the html in Developer tools, it seems to work as expected.

Screenshots

Screenshot 2024-01-08 at 23 49 26
Screenshot 2024-01-08 at 23 52 12

Gitea Version

1.21.3

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

MacOS and Windows

Browser Version

Chrome Version 120.0.6099.199

Originally created by @AsgeirSH on GitHub (Jan 8, 2024). ### Description ## Overview When downloading files from a release that contains files that browsers can open (for example a .hex-file), Gitea does not trigger a download. Instead, the file is opened in a new tab and when manually saving the content, the file type is not preserved and is instead suggested to be saved as .txt. ## Expected behavior When clicking to download a file from a release, Gitea should set the proper headers to ensure that the browser will suggest to save it with the same filename and extension as in the released file. This works as expected when clicking the Download-button in the Code view. ## Example Reproduced on the demo site: https://try.gitea.io/AsgeirSH/DownloadFileIssueRepro/releases/tag/v0.0.1 ## Suggested fix Adding a `download` attribute in the `<a>`-tag for the file. When this is added by manually editing the html in Developer tools, it seems to work as expected. ### Screenshots ![Screenshot 2024-01-08 at 23 49 26](https://github.com/go-gitea/gitea/assets/1831028/95d34254-3472-47e3-9d6c-bff9748b89a0) ![Screenshot 2024-01-08 at 23 52 12](https://github.com/go-gitea/gitea/assets/1831028/f958ca5e-942b-4a21-9593-8cbae1aa0bf9) ### Gitea Version 1.21.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Operating System MacOS and Windows ### Browser Version Chrome Version 120.0.6099.199
GiteaMirror added the topic/uitype/bug labels 2025-11-02 10:05:17 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12312