From 1a38e0273ee68dc8fe2f46d8b35b7a2d26d36ea7 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 11 Oct 2024 21:21:14 +0300 Subject: [PATCH] fix filename not applying --- src/components/settings_modal/tabs/style_tab/style_tab.js | 2 +- src/services/export_import/export_import.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.js b/src/components/settings_modal/tabs/style_tab/style_tab.js index e6667236..747649f7 100644 --- a/src/components/settings_modal/tabs/style_tab/style_tab.js +++ b/src/components/settings_modal/tabs/style_tab/style_tab.js @@ -689,7 +689,7 @@ export default { // ## Export and Import const styleExporter = newExporter({ - filename: name.value || 'pleroma_theme', + filename: () => exports.name.value ?? 'pleroma_theme', mime: 'text/plain', extension: 'piss', getExportedObject: () => exportStyleData.value diff --git a/src/services/export_import/export_import.js b/src/services/export_import/export_import.js index 397d35a9..8865061f 100644 --- a/src/services/export_import/export_import.js +++ b/src/services/export_import/export_import.js @@ -16,7 +16,8 @@ export const newExporter = ({ // Create an invisible link with a data url and simulate a click const e = document.createElement('a') - e.setAttribute('download', `${filename}.${extension}`) + const realFilename = typeof filename === 'function' ? filename() : filename + e.setAttribute('download', `${realFilename}.${extension}`) e.setAttribute('href', `data:${mime};base64, ${window.btoa(stringified)}`) e.style.display = 'none'