Skip to content

Commit 349d5b1

Browse files
committed
Do not show editor for locked lfs file by other user
1 parent 5dc082a commit 349d5b1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

routers/web/repo/editor.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ func editFile(ctx *context.Context, isNewFile bool) {
162162

163163
defer dataRc.Close()
164164

165+
if fInfo.isLFSFile {
166+
lfsLock, err := git_model.GetTreePathLock(ctx, ctx.Repo.Repository.ID, ctx.Repo.TreePath)
167+
if err != nil {
168+
ctx.ServerError("GetTreePathLock", err)
169+
return
170+
}
171+
if lfsLock != nil && lfsLock.OwnerID != ctx.Doer.ID {
172+
ctx.NotFound(nil)
173+
return
174+
}
175+
}
176+
165177
ctx.Data["FileSize"] = blob.Size()
166178

167179
// Only some file types are editable online as text.

0 commit comments

Comments
 (0)