mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-12 12:10:25 +08:00
finish 试卷查重
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user