diff --git a/packages/builder/src/components/start/AppCard.svelte b/packages/builder/src/components/start/AppCard.svelte
index a64b0527ff..aaee055c5e 100644
--- a/packages/builder/src/components/start/AppCard.svelte
+++ b/packages/builder/src/components/start/AppCard.svelte
@@ -14,9 +14,10 @@
async function exportApp() {
appExportLoading = true
try {
- download(`/api/backups/export?appId=${_id}`)
+ download(`/api/backups/export?appId=${_id}&appname=${name}`)
notifier.success("App Export Complete.")
} catch (err) {
+ console.error(err)
notifier.danger("App Export Failed.")
} finally {
appExportLoading = false
@@ -29,13 +30,13 @@
diff --git a/packages/server/src/api/controllers/backup.js b/packages/server/src/api/controllers/backup.js
index d021dca91f..c8bcafcb7c 100644
--- a/packages/server/src/api/controllers/backup.js
+++ b/packages/server/src/api/controllers/backup.js
@@ -4,12 +4,12 @@ const os = require("os")
const fs = require("fs-extra")
exports.exportAppDump = async function(ctx) {
- const { appId } = ctx.query
+ const { appId, appname } = ctx.query
const backupsDir = path.join(os.homedir(), ".budibase", "backups")
fs.ensureDirSync(backupsDir)
- const backupIdentifier = `${appId} Backup: ${new Date()}.txt`
+ const backupIdentifier = `${appname}Backup${new Date().getTime()}.txt`
await performDump({
dir: backupsDir,
@@ -23,19 +23,4 @@ exports.exportAppDump = async function(ctx) {
ctx.attachment(backupIdentifier)
ctx.body = fs.createReadStream(backupFile)
- // ctx.body = {
- // url: `/api/backups/download/${backupIdentifier}`,
- // }
}
-
-// exports.downloadAppDump = async function(ctx) {
-// const fileName = ctx.params.fileName
-
-// const backupsDir = path.join(os.homedir(), ".budibase", "backups")
-// fs.ensureDirSync(backupsDir)
-
-// const backupFile = path.join(backupsDir, fileName)
-
-// ctx.attachment(fileName)
-// ctx.body = fs.createReadStream(backupFile)
-// }
diff --git a/packages/server/src/api/routes/backup.js b/packages/server/src/api/routes/backup.js
index 283bec39a4..7f24a452e5 100644
--- a/packages/server/src/api/routes/backup.js
+++ b/packages/server/src/api/routes/backup.js
@@ -6,10 +6,5 @@ const { BUILDER } = require("../../utilities/security/permissions")
const router = Router()
router.get("/api/backups/export", authorized(BUILDER), controller.exportAppDump)
-// .get(
-// "/api/backups/download/:fileName",
-// authorized(BUILDER),
-// controller.downloadAppDump
-// )
module.exports = router