summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/http.go3
-rw-r--r--routers/repo/lfs.go4
-rw-r--r--routers/repo/settings_test.go4
3 files changed, 6 insertions, 5 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 565ee5eff4..bc3b81f511 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -31,6 +31,7 @@ import (
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
+ "code.gitea.io/gitea/modules/util"
repo_service "code.gitea.io/gitea/services/repository"
)
@@ -391,7 +392,7 @@ func dummyInfoRefs(ctx *context.Context) {
}
defer func() {
- if err := os.RemoveAll(tmpDir); err != nil {
+ if err := util.RemoveAll(tmpDir); err != nil {
log.Error("RemoveAll: %v", err)
}
}()
diff --git a/routers/repo/lfs.go b/routers/repo/lfs.go
index d8f1ce62a9..8aff89dd6a 100644
--- a/routers/repo/lfs.go
+++ b/routers/repo/lfs.go
@@ -11,7 +11,6 @@ import (
gotemplate "html/template"
"io"
"io/ioutil"
- "os"
"path"
"path/filepath"
"sort"
@@ -29,6 +28,7 @@ import (
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/util"
gogit "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
@@ -356,7 +356,7 @@ func LFSDelete(ctx *context.Context) {
// Please note a similar condition happens in models/repo.go DeleteRepository
if count == 0 {
oidPath := filepath.Join(oid[0:2], oid[2:4], oid[4:])
- err = os.Remove(filepath.Join(setting.LFS.ContentPath, oidPath))
+ err = util.Remove(filepath.Join(setting.LFS.ContentPath, oidPath))
if err != nil {
ctx.ServerError("LFSDelete", err)
return
diff --git a/routers/repo/settings_test.go b/routers/repo/settings_test.go
index 2325c0255c..97c3fb0471 100644
--- a/routers/repo/settings_test.go
+++ b/routers/repo/settings_test.go
@@ -7,7 +7,6 @@ package repo
import (
"io/ioutil"
"net/http"
- "os"
"testing"
"code.gitea.io/gitea/models"
@@ -15,6 +14,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/test"
+ "code.gitea.io/gitea/modules/util"
"github.com/stretchr/testify/assert"
)
@@ -31,7 +31,7 @@ func createSSHAuthorizedKeysTmpPath(t *testing.T) func() {
return func() {
setting.SSH.RootPath = oldPath
- os.RemoveAll(tmpDir)
+ util.RemoveAll(tmpDir)
}
}