diff --git a/pkg/models/project_duplicate.go b/pkg/models/project_duplicate.go index 26985333a..651865fee 100644 --- a/pkg/models/project_duplicate.go +++ b/pkg/models/project_duplicate.go @@ -301,7 +301,7 @@ func duplicateProjectBackground(s *xorm.Session, pd *ProjectDuplicate, doer web. } defer f.File.Close() - file, err := files.Create(f.File, f.Name, f.Size, doer) + file, err := files.CreateWithSession(s, f.File, f.Name, f.Size, doer) if err != nil { return err } diff --git a/pkg/modules/avatar/upload/upload.go b/pkg/modules/avatar/upload/upload.go index 0375011e9..97f53d5bd 100644 --- a/pkg/modules/avatar/upload/upload.go +++ b/pkg/modules/avatar/upload/upload.go @@ -171,7 +171,7 @@ func StoreAvatarFile(s *xorm.Session, u *user.User, src io.Reader) (err error) { } // Save the file - f, err := files.CreateWithMime(bytes.NewReader(buf.Bytes()), "avatar.png", uint64(buf.Len()), u, "image/png") + f, err := files.CreateWithMimeAndSession(s, bytes.NewReader(buf.Bytes()), "avatar.png", uint64(buf.Len()), u, "image/png", true) if err != nil { return err } diff --git a/pkg/modules/background/unsplash/unsplash.go b/pkg/modules/background/unsplash/unsplash.go index 310e4874d..6207eb654 100644 --- a/pkg/modules/background/unsplash/unsplash.go +++ b/pkg/modules/background/unsplash/unsplash.go @@ -312,7 +312,7 @@ func (p *Provider) Set(s *xorm.Session, image *background.Image, project *models } // Save it as a file in vikunja - file, err := files.Create(tmpFile, "", uint64(written), auth) + file, err := files.CreateWithSession(s, tmpFile, "", uint64(written), auth) if err != nil { return }