Skip to content

Commit

Permalink
Update migrations.go (xbapps#646)
Browse files Browse the repository at this point in the history
bad migration
  • Loading branch information
theRealKLH authored Jan 10, 2022
1 parent 19ea355 commit b2a7f09
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,6 @@ func Migrate() {
}

// site -> slug -> id
re := regexp.MustCompile(`(.*)-\d+$`)
newScenes := map[string]map[string]string{}
newSceneId := func(site string, slug string) (string, error) {
mapping, ok := newScenes[site]
Expand Down Expand Up @@ -644,10 +643,9 @@ func Migrate() {
for _, scene := range scenes {
trimmedURL := strings.TrimRight(scene.SceneURL, "/")
dir, base := path.Split(trimmedURL)
matches := re.FindStringSubmatch(base)
slug, ok := slugMapping[matches[1]]
slug, ok := slugMapping[base]
if !ok {
slug = slugify.Slugify(matches[1])
slug = slugify.Slugify(base)
}

sceneID, err := newSceneId(scene.Site, slug)
Expand Down

0 comments on commit b2a7f09

Please sign in to comment.