Skip to content

Fix some trivial problems #34237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion routers/api/packages/swift/swift.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func formFileOptionalReadCloser(ctx *context.Context, formKey string) (io.ReadCl
if content == "" {
return nil, nil
}
return io.NopCloser(strings.NewReader(ctx.Req.FormValue(formKey))), nil
return io.NopCloser(strings.NewReader(content)), nil
}

// UploadPackageFile refers to https://github.com/swiftlang/swift-package-manager/blob/main/Documentation/PackageRegistry/Registry.md#endpoint-6
Expand Down
11 changes: 5 additions & 6 deletions routers/web/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,28 +181,27 @@ func setMergeTarget(ctx *context.Context, pull *issues_model.PullRequest) {

// GetPullDiffStats get Pull Requests diff stats
func GetPullDiffStats(ctx *context.Context) {
// FIXME: this getPullInfo seems to be a duplicate call with other route handlers
issue, ok := getPullInfo(ctx)
if !ok {
return
}
pull := issue.PullRequest

mergeBaseCommitID := GetMergedBaseCommitID(ctx, issue)

if mergeBaseCommitID == "" {
ctx.NotFound(nil)
return
return // no merge base, do nothing, do not stop the route handler, see below
}

// do not report 500 server error to end users if error occurs, otherwise a PR missing ref won't be able to view.
headCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(pull.GetGitRefName())
if err != nil {
ctx.ServerError("GetRefCommitID", err)
log.Error("Failed to GetRefCommitID: %v, repo: %v", err, ctx.Repo.Repository.FullName())
return
}

diffShortStat, err := gitdiff.GetDiffShortStat(ctx.Repo.GitRepo, mergeBaseCommitID, headCommitID)
if err != nil {
ctx.ServerError("GetDiffShortStat", err)
log.Error("Failed to GetDiffShortStat: %v, repo: %v", err, ctx.Repo.Repository.FullName())
return
}

Expand Down
2 changes: 1 addition & 1 deletion templates/repo/tag/name.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a class="ui label basic tiny button{{if .IsRelease}} primary{{end}}" href="{{.RepoLink}}/src/tag/{{.TagName|PathEscape}}">
<a class="ui basic label tw-p-1 {{if .IsRelease}}primary{{end}}" href="{{.RepoLink}}/src/tag/{{.TagName|PathEscape}}">
{{svg "octicon-tag"}} {{.TagName}}
</a>