diff --git a/integrations/attachment_test.go b/integrations/attachment_test.go index eda6fbdb5..3dfc4faca 100644 --- a/integrations/attachment_test.go +++ b/integrations/attachment_test.go @@ -9,14 +9,12 @@ import ( "image" "image/png" "io" - "io/ioutil" "mime/multipart" "net/http" - "os" - "path" + "strings" "testing" - "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/storage" "code.gitea.io/gitea/modules/test" "github.com/stretchr/testify/assert" @@ -123,7 +121,7 @@ func TestGetAttachment(t *testing.T) { t.Run(tc.name, func(t *testing.T) { //Write empty file to be available for response if tc.createFile { - err = SaveAttachment(tc.uuid, strings.NewReader("hello world")) + err = storage.Attachments.Save(tc.RelativePath(), strings.NewReader("hello world")) assert.NoError(t, err) } //Actual test diff --git a/models/repo.go b/models/repo.go index 04a31975b..b85529ad3 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1549,7 +1549,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error { } releaseAttachments := make([]string, 0, len(attachments)) for i := 0; i < len(attachments); i++ { - releaseAttachments = append(releaseAttachments, attachments[i].UUID) + releaseAttachments = append(releaseAttachments, attachments[i].RelativePath()) } if err = deleteBeans(sess, @@ -1628,7 +1628,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error { } attachmentPaths := make([]string, 0, len(attachments)) for j := range attachments { - attachmentPaths = append(attachmentPaths, attachments[j].UUID) + attachmentPaths = append(attachmentPaths, attachments[j].RelativePath()) } if _, err = sess.In("issue_id", deleteCond). diff --git a/modules/storage/local.go b/modules/storage/local.go index 86f2bb589..7a5f00e63 100644 --- a/modules/storage/local.go +++ b/modules/storage/local.go @@ -1,3 +1,7 @@ +// Copyright 2020 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package storage import ( diff --git a/modules/storage/minio.go b/modules/storage/minio.go index 57f8d8a6b..445ac546c 100644 --- a/modules/storage/minio.go +++ b/modules/storage/minio.go @@ -1,3 +1,7 @@ +// Copyright 2020 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package storage import ( diff --git a/modules/storage/storage.go b/modules/storage/storage.go index 5034a7d4b..88e84137a 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -1,3 +1,7 @@ +// Copyright 2020 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package storage import ( @@ -39,4 +43,3 @@ func Init() error { return nil } -