Skip to content

Commit 953055f

Browse files
committed
fix
1 parent 2683adf commit 953055f

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

routers/api/packages/swift/swift.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ func formFileOptionalReadCloser(ctx *context.Context, formKey string) (io.ReadCl
304304
if content == "" {
305305
return nil, nil
306306
}
307-
return io.NopCloser(strings.NewReader(ctx.Req.FormValue(formKey))), nil
307+
return io.NopCloser(strings.NewReader(content)), nil
308308
}
309309

310310
// UploadPackageFile refers to https://github.com/swiftlang/swift-package-manager/blob/main/Documentation/PackageRegistry/Registry.md#endpoint-6

routers/web/repo/pull.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,28 +181,27 @@ func setMergeTarget(ctx *context.Context, pull *issues_model.PullRequest) {
181181

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

190191
mergeBaseCommitID := GetMergedBaseCommitID(ctx, issue)
191-
192192
if mergeBaseCommitID == "" {
193-
ctx.NotFound(nil)
194-
return
193+
return // no merge base, do nothing, do not stop the route handler, see below
195194
}
196195

196+
// do not report 500 server error to end users if error occurs, otherwise a PR missing ref won't be able to view.
197197
headCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(pull.GetGitRefName())
198198
if err != nil {
199-
ctx.ServerError("GetRefCommitID", err)
199+
log.Error("Failed to GetRefCommitID: %v, repo: %v", err, ctx.Repo.Repository.FullName())
200200
return
201201
}
202-
203202
diffShortStat, err := gitdiff.GetDiffShortStat(ctx.Repo.GitRepo, mergeBaseCommitID, headCommitID)
204203
if err != nil {
205-
ctx.ServerError("GetDiffShortStat", err)
204+
log.Error("Failed to GetDiffShortStat: %v, repo: %v", err, ctx.Repo.Repository.FullName())
206205
return
207206
}
208207

templates/repo/tag/name.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<a class="ui label basic tiny button{{if .IsRelease}} primary{{end}}" href="{{.RepoLink}}/src/tag/{{.TagName|PathEscape}}">
1+
<a class="ui basic label tw-p-1 {{if .IsRelease}}primary{{end}}" href="{{.RepoLink}}/src/tag/{{.TagName|PathEscape}}">
22
{{svg "octicon-tag"}} {{.TagName}}
33
</a>

0 commit comments

Comments
 (0)