Fixing an issue where plugins are imported as apps, which can crash the service - return a useful message to tell the user this is a plugin not an app export.
This commit is contained in:
parent
c9bdf6fa3e
commit
77eb805936
|
@ -191,6 +191,16 @@ export async function importApp(
|
||||||
if (stillEncrypted) {
|
if (stillEncrypted) {
|
||||||
throw new Error("Files are encrypted but no password has been supplied.")
|
throw new Error("Files are encrypted but no password has been supplied.")
|
||||||
}
|
}
|
||||||
|
const isPlugin = !!contents.find(name => name === "plugin.min.js")
|
||||||
|
if (isPlugin) {
|
||||||
|
throw new Error("Supplied file is a plugin - cannot import as app.")
|
||||||
|
}
|
||||||
|
const isInvalid = !contents.find(name => name === DB_EXPORT_FILE)
|
||||||
|
if (isInvalid) {
|
||||||
|
throw new Error(
|
||||||
|
"App export does not appear to be valid - no DB file found."
|
||||||
|
)
|
||||||
|
}
|
||||||
// have to handle object import
|
// have to handle object import
|
||||||
if (contents.length && opts.importObjStoreContents) {
|
if (contents.length && opts.importObjStoreContents) {
|
||||||
let promises = []
|
let promises = []
|
||||||
|
|
Loading…
Reference in New Issue