From 7c09f24f340838353ee7c4d561eedd14715c9fe0 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:25:56 +1000 Subject: [PATCH] Don't try to migrate non-existent vtt files (#5216) --- pkg/scene/migrate_hash.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/scene/migrate_hash.go b/pkg/scene/migrate_hash.go index 9b74e571d..a71353403 100644 --- a/pkg/scene/migrate_hash.go +++ b/pkg/scene/migrate_hash.go @@ -65,6 +65,17 @@ func migrateSceneFiles(oldName, newName string) { // #2481: migrate vtt file contents in addition to renaming func migrateVttFile(vttPath, oldSpritePath, newSpritePath string) { + // #3356 - don't try to migrate if the file doesn't exist + exists, err := fsutil.FileExists(vttPath) + if err != nil && !os.IsNotExist(err) { + logger.Errorf("Error checking existence of %s: %s", vttPath, err.Error()) + return + } + + if !exists { + return + } + contents, err := os.ReadFile(vttPath) if err != nil { logger.Errorf("Error reading %s for vtt migration: %v", vttPath, err)