forked from forgejo/forgejo
Copy git data from disk when restore repository (#16066)
This commit is contained in:
parent
a38f62ad0f
commit
7979c3654e
3 changed files with 11 additions and 6 deletions
|
@ -276,19 +276,22 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error {
|
|||
// asset.DownloadURL maybe a local file
|
||||
var rc io.ReadCloser
|
||||
var err error
|
||||
if asset.DownloadURL == nil {
|
||||
if asset.DownloadFunc != nil {
|
||||
rc, err = asset.DownloadFunc()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
} else if asset.DownloadURL != nil {
|
||||
rc, err = uri.Open(*asset.DownloadURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
defer rc.Close()
|
||||
if rc == nil {
|
||||
return nil
|
||||
}
|
||||
_, err = storage.Attachments.Save(attach.RelativePath(), rc, int64(*asset.Size))
|
||||
rc.Close()
|
||||
return err
|
||||
}()
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue