Don't try to migrate non-existent vtt files (#5216)

This commit is contained in:
WithoutPants 2024-09-05 11:25:56 +10:00 committed by GitHub
parent fb82866512
commit 7c09f24f34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -65,6 +65,17 @@ func migrateSceneFiles(oldName, newName string) {
// #2481: migrate vtt file contents in addition to renaming // #2481: migrate vtt file contents in addition to renaming
func migrateVttFile(vttPath, oldSpritePath, newSpritePath string) { 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) contents, err := os.ReadFile(vttPath)
if err != nil { if err != nil {
logger.Errorf("Error reading %s for vtt migration: %v", vttPath, err) logger.Errorf("Error reading %s for vtt migration: %v", vttPath, err)