Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions modules/migration/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import (

// ReleaseAsset represents a release asset
type ReleaseAsset struct {
ID int64
Name string
ContentType *string `yaml:"content_type"`
ID int64
Name string

// There was a field "ContentType (content_type)" because Some forges can provide that for assets,
// but we don't need it when migrating, so the field is omitted here.

Size *int
DownloadCount *int `yaml:"download_count"`
Created time.Time
Expand Down
1 change: 0 additions & 1 deletion services/migrations/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ func (g *GithubDownloaderV3) convertGithubRelease(ctx context.Context, rel *gith
r.Assets = append(r.Assets, &base.ReleaseAsset{
ID: asset.GetID(),
Name: asset.GetName(),
ContentType: asset.ContentType,
Size: asset.Size,
DownloadCount: asset.DownloadCount,
Created: asset.CreatedAt.Time,
Expand Down
3 changes: 1 addition & 2 deletions services/migrations/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,11 @@ func (g *GitlabDownloader) convertGitlabRelease(ctx context.Context, rel *gitlab

httpClient := NewMigrationHTTPClient()

for k, asset := range rel.Assets.Links {
for _, asset := range rel.Assets.Links {
assetID := asset.ID // Don't optimize this, for closure we need a local variable
r.Assets = append(r.Assets, &base.ReleaseAsset{
ID: int64(asset.ID),
Name: asset.Name,
ContentType: &rel.Assets.Sources[k].Format,
Size: &zero,
DownloadCount: &zero,
DownloadFunc: func() (io.ReadCloser, error) {
Expand Down
1 change: 0 additions & 1 deletion services/migrations/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ func assertReactionsEqual(t *testing.T, expected, actual []*base.Reaction) {
func assertReleaseAssetEqual(t *testing.T, expected, actual *base.ReleaseAsset) {
assert.Equal(t, expected.ID, actual.ID)
assert.Equal(t, expected.Name, actual.Name)
assert.Equal(t, expected.ContentType, actual.ContentType)
assert.Equal(t, expected.Size, actual.Size)
assert.Equal(t, expected.DownloadCount, actual.DownloadCount)
assertTimeEqual(t, expected.Created, actual.Created)
Expand Down