Skip to content

Release downloads should trigger a download #28736

Closed
@AsgeirSH

Description

@AsgeirSH

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/uiChange the appearance of the Gitea UItype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions