Fix a sad, sad bug that resulted in 100+MB config.json

This commit is contained in:
DC
2016-09-19 22:30:46 -07:00
parent 205e17cc83
commit f368dfad81
2 changed files with 21 additions and 3 deletions

View File

@@ -39,6 +39,10 @@ function run (state) {
migrate_0_14_0(state.saved)
}
if (semver.lt(version, '0.17.0')) {
migrate_0_17_0(state.saved)
}
// Config is now on the new version
state.saved.version = config.APP_VERSION
}
@@ -145,3 +149,15 @@ function migrate_0_14_0 (saved) {
delete ts.defaultPlayFileIndex
})
}
function migrate_0_17_0 (saved) {
// Fix a sad, sad bug that resulted in 100MB+ config.json files
saved.torrents.forEach(function (ts) {
if (!ts.files) return
ts.files.forEach(function (file) {
if (!file.audioInfo || !file.audioInfo.picture) return
// This contained a Buffer, which 30x'd in size when serialized to JSON
delete file.audioInfo.picture
})
})
}