summaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/base.go2
-rw-r--r--routers/web/repo/actions/view.go4
-rw-r--r--routers/web/repo/activity.go1
-rw-r--r--routers/web/repo/attachment.go2
-rw-r--r--routers/web/repo/commit.go1
-rw-r--r--routers/web/repo/compare.go3
-rw-r--r--routers/web/repo/download.go4
-rw-r--r--routers/web/repo/pull.go7
-rw-r--r--routers/web/repo/repo.go2
-rw-r--r--routers/web/repo/view.go1
10 files changed, 15 insertions, 12 deletions
diff --git a/routers/web/base.go b/routers/web/base.go
index 78dde57fa6..285d1ecddc 100644
--- a/routers/web/base.go
+++ b/routers/web/base.go
@@ -39,7 +39,7 @@ func storageHandler(storageSetting *setting.Storage, prefix string, objStore sto
rPath := strings.TrimPrefix(req.URL.Path, "/"+prefix+"/")
rPath = util.PathJoinRelX(rPath)
- u, err := objStore.URL(rPath, path.Base(rPath))
+ u, err := objStore.URL(rPath, path.Base(rPath), nil)
if err != nil {
if os.IsNotExist(err) || errors.Is(err, os.ErrNotExist) {
log.Warn("Unable to find %s %s", prefix, rPath)
diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go
index bc1ecbfc1e..e7dbb6d975 100644
--- a/routers/web/repo/actions/view.go
+++ b/routers/web/repo/actions/view.go
@@ -307,7 +307,6 @@ func ViewPost(ctx *context_module.Context) {
if validCursor {
length := step.LogLength - cursor.Cursor
offset := task.LogIndexes[index]
- var err error
logRows, err := actions.ReadLogs(ctx, task.LogInStorage, task.LogFilename, offset, length)
if err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
@@ -689,7 +688,8 @@ func ArtifactsDownloadView(ctx *context_module.Context) {
if len(artifacts) == 1 && artifacts[0].ArtifactName+".zip" == artifacts[0].ArtifactPath && artifacts[0].ContentEncoding == "application/zip" {
art := artifacts[0]
if setting.Actions.ArtifactStorage.MinioConfig.ServeDirect {
- u, err := storage.ActionsArtifacts.URL(art.StoragePath, art.ArtifactPath)
+ u, err := storage.ActionsArtifacts.URL(art.StoragePath, art.ArtifactPath, nil)
+
if u != nil && err == nil {
ctx.Redirect(u.String())
return
diff --git a/routers/web/repo/activity.go b/routers/web/repo/activity.go
index 954446be36..af9cea0f33 100644
--- a/routers/web/repo/activity.go
+++ b/routers/web/repo/activity.go
@@ -94,7 +94,6 @@ func ActivityAuthors(ctx *context.Context) {
timeFrom = timeUntil.Add(-time.Hour * 168)
}
- var err error
authors, err := activities_model.GetActivityStatsTopAuthors(ctx, ctx.Repo.Repository, timeFrom, 10)
if err != nil {
ctx.ServerError("GetActivityStatsTopAuthors", err)
diff --git a/routers/web/repo/attachment.go b/routers/web/repo/attachment.go
index b42effd8c3..b5078e1f63 100644
--- a/routers/web/repo/attachment.go
+++ b/routers/web/repo/attachment.go
@@ -134,7 +134,7 @@ func ServeAttachment(ctx *context.Context, uuid string) {
if setting.Attachment.Storage.MinioConfig.ServeDirect {
// If we have a signed url (S3, object storage), redirect to this directly.
- u, err := storage.Attachments.URL(attach.RelativePath(), attach.Name)
+ u, err := storage.Attachments.URL(attach.RelativePath(), attach.Name, nil)
if u != nil && err == nil {
ctx.Redirect(u.String())
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go
index 0e5d1f0a1f..1428238074 100644
--- a/routers/web/repo/commit.go
+++ b/routers/web/repo/commit.go
@@ -338,6 +338,7 @@ func Diff(ctx *context.Context) {
MaxLineCharacters: setting.Git.MaxGitDiffLineCharacters,
MaxFiles: maxFiles,
WhitespaceBehavior: gitdiff.GetWhitespaceFlag(ctx.Data["WhitespaceBehavior"].(string)),
+ FileOnly: fileOnly,
}, files...)
if err != nil {
ctx.NotFound("GetDiff", err)
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index 38d6004ec6..e5eab2bffa 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -611,6 +611,8 @@ func PrepareCompareDiff(
maxLines, maxFiles = -1, -1
}
+ fileOnly := ctx.FormBool("file-only")
+
diff, err := gitdiff.GetDiff(ctx, ci.HeadGitRepo,
&gitdiff.DiffOptions{
BeforeCommitID: beforeCommitID,
@@ -621,6 +623,7 @@ func PrepareCompareDiff(
MaxFiles: maxFiles,
WhitespaceBehavior: whitespaceBehavior,
DirectComparison: ci.DirectComparison,
+ FileOnly: fileOnly,
}, ctx.FormStrings("files")...)
if err != nil {
ctx.ServerError("GetDiffRangeWithWhitespaceBehavior", err)
diff --git a/routers/web/repo/download.go b/routers/web/repo/download.go
index c4a8baecca..1e87bbf015 100644
--- a/routers/web/repo/download.go
+++ b/routers/web/repo/download.go
@@ -54,8 +54,8 @@ func ServeBlobOrLFS(ctx *context.Context, blob *git.Blob, lastModified *time.Tim
}
if setting.LFS.Storage.MinioConfig.ServeDirect {
- // If we have a signed url (S3, object storage), redirect to this directly.
- u, err := storage.LFS.URL(pointer.RelativePath(), blob.Name())
+ // If we have a signed url (S3, object storage, blob storage), redirect to this directly.
+ u, err := storage.LFS.URL(pointer.RelativePath(), blob.Name(), nil)
if u != nil && err == nil {
ctx.Redirect(u.String())
return nil
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 9d0dcad61e..98dacc1a0d 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -614,12 +614,12 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
var headBranchSha string
// HeadRepo may be missing
if pull.HeadRepo != nil {
- headGitRepo, err := gitrepo.OpenRepository(ctx, pull.HeadRepo)
+ headGitRepo, closer, err := gitrepo.RepositoryFromContextOrOpen(ctx, pull.HeadRepo)
if err != nil {
- ctx.ServerError("OpenRepository", err)
+ ctx.ServerError("RepositoryFromContextOrOpen", err)
return nil
}
- defer headGitRepo.Close()
+ defer closer.Close()
if pull.Flow == issues_model.PullRequestFlowGithub {
headBranchExist = headGitRepo.IsBranchExist(pull.HeadBranch)
@@ -966,6 +966,7 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
MaxLineCharacters: setting.Git.MaxGitDiffLineCharacters,
MaxFiles: maxFiles,
WhitespaceBehavior: gitdiff.GetWhitespaceFlag(ctx.Data["WhitespaceBehavior"].(string)),
+ FileOnly: fileOnly,
}
if !willShowSpecifiedCommit {
diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go
index 9562491440..8036bcae67 100644
--- a/routers/web/repo/repo.go
+++ b/routers/web/repo/repo.go
@@ -505,7 +505,7 @@ func download(ctx *context.Context, archiveName string, archiver *repo_model.Rep
rPath := archiver.RelativePath()
if setting.RepoArchive.Storage.MinioConfig.ServeDirect {
// If we have a signed url (S3, object storage), redirect to this directly.
- u, err := storage.RepoArchives.URL(rPath, downloadName)
+ u, err := storage.RepoArchives.URL(rPath, downloadName, nil)
if u != nil && err == nil {
if archiver.ReleaseID != 0 {
err = repo_model.CountArchiveDownload(ctx, ctx.Repo.Repository.ID, archiver.ReleaseID, archiver.Type)
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index f1445c580a..41ff5f97f7 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -147,7 +147,6 @@ func FindReadmeFileInEntries(ctx *context.Context, entries []*git.TreeEntry, try
// this should be impossible; if subTreeEntry exists so should this.
continue
}
- var err error
childEntries, err := subTree.ListEntries()
if err != nil {
return "", nil, err