From 0eae22d429a66f137daa200f559883a6b6a31de0 Mon Sep 17 00:00:00 2001 From: Gusted Date: Tue, 28 Nov 2023 12:46:34 +0100 Subject: [PATCH] [GITEA] Add download URL for executable files - Consider executable files as a valid case when returning a downloadURL for them. They are just regular files with the difference being the executable permission bit being set. - Not integration testing as it's not possible without adding adjusting the existing repositories to have a executable file. - Resolves https://codeberg.org/forgejo/forgejo/issues/1825 (cherry picked from commit ca32891d548c302b0f3b3072647058278ffb9cbf) (cherry picked from commit 72c9df8e457ea291f767e6edf2b3c8f9af15700f) --- services/repository/files/content.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/repository/files/content.go b/services/repository/files/content.go index 30d62fbcdf..8a3219bb18 100644 --- a/services/repository/files/content.go +++ b/services/repository/files/content.go @@ -219,7 +219,7 @@ func GetContents(ctx context.Context, repo *repo_model.Repository, treePath, ref } } // Handle links - if entry.IsRegular() || entry.IsLink() { + if entry.IsRegular() || entry.IsLink() || entry.IsExecutable() { downloadURL, err := url.Parse(repo.HTMLURL() + "/raw/" + url.PathEscape(string(refType)) + "/" + util.PathEscapeSegments(ref) + "/" + util.PathEscapeSegments(treePath)) if err != nil { return nil, err