1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-12 12:10:25 +08:00

finish 试卷查重

This commit is contained in:
源文雨
2023-04-17 22:35:54 +08:00
parent 67b6abf001
commit e2a8cdf5b3
13 changed files with 475 additions and 34 deletions

View File

@@ -497,7 +497,7 @@ func (f *FileDatabase) DelFile(lstid, uid int, istemp bool) error {
if err != nil {
return err
}
if !user.IsSuper() {
if !user.IsSuper() && !istemp {
return ErrInvalidRole
}
ftable := ""
@@ -512,6 +512,9 @@ func (f *FileDatabase) DelFile(lstid, uid int, istemp bool) error {
if err != nil {
return err
}
if istemp && lst.Uploader != uid {
return ErrInvalidRole
}
if lst.Path == "" || strings.Contains(lst.Path, "..") {
return os.ErrNotExist
}