diff options
author | Gusted <williamzijl7@hotmail.com> | 2021-11-15 06:02:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-15 14:02:53 +0800 |
commit | 253d9e415813e90543cca8d94112c9e4238d39a4 (patch) | |
tree | c60e0dc33e437dfbd4855b9c0b5939351451720f /routers/web | |
parent | 562785ef4ea8ea4b24da726a4fbf515358ee7084 (diff) | |
download | gitea-253d9e415813e90543cca8d94112c9e4238d39a4.tar.gz gitea-253d9e415813e90543cca8d94112c9e4238d39a4.zip |
Remove unnecassary calls to `filepath.Join` (#17608)
- Partialy resolvess #17596
- Resolves `badCall` errors from go-critic `badCall: suspicious Join on
1 argument`
- When only 1 argument is passed into `filepath.Join`, it won't do
anything special other than `filepath.Clean(...)` will be applied over
it.
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/user/setting/adopt.go | 2 | ||||
-rw-r--r-- | routers/web/user/setting/profile.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/routers/web/user/setting/adopt.go b/routers/web/user/setting/adopt.go index e45a8a1324..2caccb69a5 100644 --- a/routers/web/user/setting/adopt.go +++ b/routers/web/user/setting/adopt.go @@ -27,7 +27,7 @@ func AdoptOrDeleteRepository(ctx *context.Context) { action := ctx.FormString("action") ctxUser := ctx.User - root := filepath.Join(models.UserPath(ctxUser.LowerName)) + root := models.UserPath(ctxUser.LowerName) // check not a repo has, err := models.IsRepositoryExist(ctxUser, dir) diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go index 4a09006150..d7aa3264c5 100644 --- a/routers/web/user/setting/profile.go +++ b/routers/web/user/setting/profile.go @@ -250,7 +250,7 @@ func Repos(ctx *context.Context) { repoNames := make([]string, 0, setting.UI.Admin.UserPagingNum) repos := map[string]*models.Repository{} // We're going to iterate by pagesize. - root := filepath.Join(models.UserPath(ctxUser.Name)) + root := models.UserPath(ctxUser.Name) if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if err != nil { if os.IsNotExist(err) { |