diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-03-14 23:18:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 16:18:27 +0100 |
commit | 49db87a035a28cd8eaa4abdd5832f952ca6449d9 (patch) | |
tree | 231676f5ca713844297cc16a52700fc50c8712fb /routers/web | |
parent | 3ad6cf20695ea4e56e00427c6af76efc25e9b670 (diff) | |
download | gitea-49db87a035a28cd8eaa4abdd5832f952ca6449d9.tar.gz gitea-49db87a035a28cd8eaa4abdd5832f952ca6449d9.zip |
Fix lfs bug (#19072)
* Fix lfs bug
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/repo/lfs.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/routers/web/repo/lfs.go b/routers/web/repo/lfs.go index d2d62786fe..c0f6b039d6 100644 --- a/routers/web/repo/lfs.go +++ b/routers/web/repo/lfs.go @@ -253,6 +253,13 @@ func LFSFileGet(ctx *context.Context) { } ctx.Data["LFSFilesLink"] = ctx.Repo.RepoLink + "/settings/lfs" oid := ctx.Params("oid") + + p := lfs.Pointer{Oid: oid} + if !p.IsValid() { + ctx.NotFound("LFSFileGet", nil) + return + } + ctx.Data["Title"] = oid ctx.Data["PageIsSettingsLFS"] = true meta, err := models.GetLFSMetaObjectByOid(ctx.Repo.Repository.ID, oid) @@ -343,6 +350,12 @@ func LFSDelete(ctx *context.Context) { return } oid := ctx.Params("oid") + p := lfs.Pointer{Oid: oid} + if !p.IsValid() { + ctx.NotFound("LFSDelete", nil) + return + } + count, err := models.RemoveLFSMetaObjectByOid(ctx.Repo.Repository.ID, oid) if err != nil { ctx.ServerError("LFSDelete", err) |