Make sure password is always requested when working with encrypted files - if the enc file has been copied the name may change format, we should handle if this happens.
This commit is contained in:
parent
c905d64f31
commit
2e7f75e93c
|
@ -26,6 +26,7 @@
|
||||||
const values = writable({ name: "", url: null })
|
const values = writable({ name: "", url: null })
|
||||||
const validation = createValidationStore()
|
const validation = createValidationStore()
|
||||||
const encryptionValidation = createValidationStore()
|
const encryptionValidation = createValidationStore()
|
||||||
|
const isEncryptedRegex = /^.*\.enc.*\.tar\.gz$/gm
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
const { url } = $values
|
const { url } = $values
|
||||||
|
@ -37,7 +38,9 @@
|
||||||
encryptionValidation.check({ ...$values })
|
encryptionValidation.check({ ...$values })
|
||||||
}
|
}
|
||||||
|
|
||||||
$: encryptedFile = $values.file?.name?.endsWith(".enc.tar.gz")
|
// filename should be separated to avoid updates everytime any other form element changes
|
||||||
|
$: filename = $values.file?.name
|
||||||
|
$: encryptedFile = isEncryptedRegex.test(filename)
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const lastChar = $auth.user?.firstName
|
const lastChar = $auth.user?.firstName
|
||||||
|
@ -171,7 +174,7 @@
|
||||||
try {
|
try {
|
||||||
await createNewApp()
|
await createNewApp()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error creating app")
|
notifications.error(`Error creating app - ${error.message}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
await auth.setInitInfo({})
|
await auth.setInitInfo({})
|
||||||
$goto(`/builder/app/${createdApp.instance._id}`)
|
$goto(`/builder/app/${createdApp.instance._id}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error creating app")
|
notifications.error(`Error creating app - ${error.message}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,10 @@ export async function importApp(
|
||||||
await decryptFiles(tmpPath, template.file.password)
|
await decryptFiles(tmpPath, template.file.password)
|
||||||
}
|
}
|
||||||
const contents = await fsp.readdir(tmpPath)
|
const contents = await fsp.readdir(tmpPath)
|
||||||
|
const stillEncrypted = !!contents.find(name => name.endsWith(".enc"))
|
||||||
|
if (stillEncrypted) {
|
||||||
|
throw new Error("Files are encrypted but no password has been supplied.")
|
||||||
|
}
|
||||||
// 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