0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-16 03:57:35 +02:00

Fix dump release asset bug (#36799)

This commit is contained in:
Lunny Xiao 2026-03-05 12:30:57 -08:00 committed by GitHub
parent 9fe5b70e3e
commit 833304ac15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -288,12 +288,13 @@ func (g *RepositoryDumper) CreateLabels(_ context.Context, labels ...*base.Label
func (g *RepositoryDumper) CreateReleases(_ context.Context, releases ...*base.Release) error {
if g.opts.ReleaseAssets {
for _, release := range releases {
attachDir := filepath.Join("release_assets", release.TagName)
attachDir := filepath.Join("release_assets", uuid.New().String())
if err := os.MkdirAll(filepath.Join(g.baseDir, attachDir), os.ModePerm); err != nil {
return err
}
for _, asset := range release.Assets {
attachLocalPath := filepath.Join(attachDir, asset.Name)
// we cannot use asset.Name because it might contains special characters.
attachLocalPath := filepath.Join(attachDir, uuid.New().String())
// SECURITY: We cannot check the DownloadURL and DownloadFunc are safe here
// ... we must assume that they are safe and simply download the attachment