mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-03 11:33:24 +09:00
fix: correct repo/attatchment absolute url and release layout (#39178)
This commit is contained in:
@@ -202,29 +202,17 @@ func getFileContentsByEntryInternal(ctx context.Context, repo *repo_model.Reposi
|
||||
}
|
||||
// Handle links
|
||||
if entry.IsRegular() || entry.IsLink() || entry.IsExecutable() {
|
||||
downloadURL, err := url.Parse(repo.HTMLURL() + "/raw/" + refCommit.RefName.RefWebLinkPath() + "/" + util.PathEscapeSegments(opts.TreePath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
downloadURLString := downloadURL.String()
|
||||
contentsResponse.DownloadURL = &downloadURLString
|
||||
downloadURL := repo.HTMLURL(ctx) + "/raw/" + refCommit.RefName.RefWebLinkPath() + "/" + util.PathEscapeSegments(opts.TreePath)
|
||||
contentsResponse.DownloadURL = &downloadURL
|
||||
}
|
||||
if !entry.IsSubModule() {
|
||||
htmlURL, err := url.Parse(repo.HTMLURL() + "/src/" + refCommit.RefName.RefWebLinkPath() + "/" + util.PathEscapeSegments(opts.TreePath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
htmlURLString := htmlURL.String()
|
||||
contentsResponse.HTMLURL = &htmlURLString
|
||||
contentsResponse.Links.HTMLURL = &htmlURLString
|
||||
htmlURL := repo.HTMLURL(ctx) + "/src/" + refCommit.RefName.RefWebLinkPath() + "/" + util.PathEscapeSegments(opts.TreePath)
|
||||
contentsResponse.HTMLURL = &htmlURL
|
||||
contentsResponse.Links.HTMLURL = &htmlURL
|
||||
|
||||
gitURL, err := url.Parse(repo.APIURL() + "/git/blobs/" + url.PathEscape(entry.ID.String()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
gitURLString := gitURL.String()
|
||||
contentsResponse.GitURL = &gitURLString
|
||||
contentsResponse.Links.GitURL = &gitURLString
|
||||
gitURL := repo.APIURL(ctx) + "/git/blobs/" + url.PathEscape(entry.ID.String())
|
||||
contentsResponse.GitURL = &gitURL
|
||||
contentsResponse.Links.GitURL = &gitURL
|
||||
}
|
||||
|
||||
return contentsResponse, nil
|
||||
|
||||
@@ -89,13 +89,13 @@ func GetFileCommitResponse(ctx context.Context, repo *repo_model.Repository, git
|
||||
}
|
||||
}
|
||||
}
|
||||
commitHTMLURL, _ := url.Parse(repo.HTMLURL() + "/commit/" + url.PathEscape(commit.ID.String()))
|
||||
commitHTMLURL := repo.HTMLURL(ctx) + "/commit/" + url.PathEscape(commit.ID.String())
|
||||
fileCommit := &api.FileCommitResponse{
|
||||
CommitMeta: api.CommitMeta{
|
||||
SHA: commit.ID.String(),
|
||||
URL: commitURL.String(),
|
||||
},
|
||||
HTMLURL: commitHTMLURL.String(),
|
||||
HTMLURL: commitHTMLURL,
|
||||
Author: &api.CommitUser{
|
||||
Identity: api.Identity{
|
||||
Name: commit.Author.Name,
|
||||
|
||||
Reference in New Issue
Block a user