| @@ -9,14 +9,12 @@ import ( | |||||
| "image" | "image" | ||||
| "image/png" | "image/png" | ||||
| "io" | "io" | ||||
| "io/ioutil" | |||||
| "mime/multipart" | "mime/multipart" | ||||
| "net/http" | "net/http" | ||||
| "os" | |||||
| "path" | |||||
| "strings" | |||||
| "testing" | "testing" | ||||
| "code.gitea.io/gitea/models" | |||||
| "code.gitea.io/gitea/modules/storage" | |||||
| "code.gitea.io/gitea/modules/test" | "code.gitea.io/gitea/modules/test" | ||||
| "github.com/stretchr/testify/assert" | "github.com/stretchr/testify/assert" | ||||
| @@ -123,7 +121,7 @@ func TestGetAttachment(t *testing.T) { | |||||
| t.Run(tc.name, func(t *testing.T) { | t.Run(tc.name, func(t *testing.T) { | ||||
| //Write empty file to be available for response | //Write empty file to be available for response | ||||
| if tc.createFile { | 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) | assert.NoError(t, err) | ||||
| } | } | ||||
| //Actual test | //Actual test | ||||
| @@ -1549,7 +1549,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error { | |||||
| } | } | ||||
| releaseAttachments := make([]string, 0, len(attachments)) | releaseAttachments := make([]string, 0, len(attachments)) | ||||
| for i := 0; i < len(attachments); i++ { | for i := 0; i < len(attachments); i++ { | ||||
| releaseAttachments = append(releaseAttachments, attachments[i].UUID) | |||||
| releaseAttachments = append(releaseAttachments, attachments[i].RelativePath()) | |||||
| } | } | ||||
| if err = deleteBeans(sess, | if err = deleteBeans(sess, | ||||
| @@ -1628,7 +1628,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error { | |||||
| } | } | ||||
| attachmentPaths := make([]string, 0, len(attachments)) | attachmentPaths := make([]string, 0, len(attachments)) | ||||
| for j := range attachments { | for j := range attachments { | ||||
| attachmentPaths = append(attachmentPaths, attachments[j].UUID) | |||||
| attachmentPaths = append(attachmentPaths, attachments[j].RelativePath()) | |||||
| } | } | ||||
| if _, err = sess.In("issue_id", deleteCond). | if _, err = sess.In("issue_id", deleteCond). | ||||
| @@ -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 | package storage | ||||
| import ( | import ( | ||||
| @@ -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 | package storage | ||||
| import ( | import ( | ||||
| @@ -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 | package storage | ||||
| import ( | import ( | ||||
| @@ -39,4 +43,3 @@ func Init() error { | |||||
| return nil | return nil | ||||
| } | } | ||||