Skip to content

Commit

Permalink
Add download URL for executable files (#28260)
Browse files Browse the repository at this point in the history
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.

Co-authored-by: Gusted <[email protected]>
  • Loading branch information
earl-warren and Gusted committed Mar 6, 2024
1 parent c996e35 commit f6d01ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion services/repository/files/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,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
Expand Down

0 comments on commit f6d01ac

Please sign in to comment.