summaryrefslogtreecommitdiffstats
path: root/modules/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'modules/migrations')
-rw-r--r--modules/migrations/gitea.go15
1 files changed, 2 insertions, 13 deletions
diff --git a/modules/migrations/gitea.go b/modules/migrations/gitea.go
index 7d446fb408..8c097e143c 100644
--- a/modules/migrations/gitea.go
+++ b/modules/migrations/gitea.go
@@ -13,7 +13,6 @@ import (
"net/http"
"net/url"
"os"
- "path"
"path/filepath"
"strings"
"sync"
@@ -26,6 +25,7 @@ import (
"code.gitea.io/gitea/modules/repository"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/storage"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
@@ -275,18 +275,7 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error {
}
defer resp.Body.Close()
- localPath := attach.LocalPath()
- if err = os.MkdirAll(path.Dir(localPath), os.ModePerm); err != nil {
- return fmt.Errorf("MkdirAll: %v", err)
- }
-
- fw, err := os.Create(localPath)
- if err != nil {
- return fmt.Errorf("Create: %v", err)
- }
- defer fw.Close()
-
- _, err = io.Copy(fw, resp.Body)
+ _, err = storage.Attachments.Save(attach.RelativePath(), resp.Body)
return err
}()
if err != nil {