Skip to content

Commit

Permalink
Merge pull request #1323 from ebkr/zip-extract-error-handling
Browse files Browse the repository at this point in the history
Add error handling to zip extracting when importing profiles
  • Loading branch information
anttimaki authored May 27, 2024
2 parents 84672f9 + b15eae5 commit 9760786
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions src/pages/Profiles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -558,24 +558,36 @@ export default class Profiles extends Vue {
const entries = await ZipProvider.instance.getEntries(files[0]);
for (const entry of entries) {
if (entry.entryName.startsWith('config/') || entry.entryName.startsWith("config\\")) {
await ZipProvider.instance.extractEntryTo(
files[0],
entry.entryName,
path.join(
Profile.getDirectory(),
profileName,
'BepInEx'
)
);
try {
await ZipProvider.instance.extractEntryTo(
files[0],
entry.entryName,
path.join(
Profile.getDirectory(),
profileName,
'BepInEx'
)
);
} catch (e) {
const err = R2Error.fromThrownValue(e, 'Error while trying to extract a Zip file while importing a profile');
this.$store.commit('error/handleError', err);
return;
}
} else if (entry.entryName.toLowerCase() !== "export.r2x") {
await ZipProvider.instance.extractEntryTo(
files[0],
entry.entryName,
path.join(
Profile.getDirectory(),
profileName
try {
await ZipProvider.instance.extractEntryTo(
files[0],
entry.entryName,
path.join(
Profile.getDirectory(),
profileName
)
)
)
} catch (e) {
const err = R2Error.fromThrownValue(e, 'Error while trying to extract a Zip file while importing a profile');
this.$store.commit('error/handleError', err);
return;
}
}
}
}
Expand Down

0 comments on commit 9760786

Please sign in to comment.