1
0

fix(files): use absolute path everywhere

(cherry picked from commit 68636f27da707f3ee87ba0e4f1ff100504486608)
This commit is contained in:
kolaente
2024-09-06 12:55:35 +02:00
parent cca02a3f2e
commit 0b9f3070fd
11 changed files with 45 additions and 31 deletions

View File

@ -128,11 +128,8 @@ func CreateWithMimeAndSession(s *xorm.Session, f io.Reader, realname string, rea
}
// Delete removes a file from the DB and the file system
func (f *File) Delete() (err error) {
s := db.NewSession()
defer s.Close()
deleted, err := s.Where("id = ?", f.ID).Delete(f)
func (f *File) Delete(s *xorm.Session) (err error) {
deleted, err := s.Where("id = ?", f.ID).Delete(&File{})
if err != nil {
_ = s.Rollback()
return err