[pbs-devel] [PATCH widget-toolkit v1 3/3] fix #4001: FileBrowser: add a configurable prefix to downloaded files

Stefan Sterz s.sterz at proxmox.com
Thu May 5 15:52:50 CEST 2022


Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
---
 src/window/FileBrowser.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/window/FileBrowser.js b/src/window/FileBrowser.js
index 54967c2..9ad2e81 100644
--- a/src/window/FileBrowser.js
+++ b/src/window/FileBrowser.js
@@ -93,6 +93,9 @@ Ext.define("Proxmox.window.FileBrowser", {
 	// "Download" button when the selection can be downloaded as
 	// .tar files
 	enableTar: false,
+
+	// prefix to prepend to downloaded file names
+	downloadPrefix: '',
     },
 
     controller: {
@@ -124,12 +127,11 @@ Ext.define("Proxmox.window.FileBrowser", {
 
 	    let data = selection[0].data;
 
-	    let atag = document.createElement('a');
-
-	    atag.download = data.text;
 	    let params = { ...view.extraParams };
 	    params.filepath = data.filepath;
-	    atag.download = data.text;
+
+	    let atag = document.createElement('a');
+	    atag.download = view.downloadPrefix + data.text;
 	    if (data.type === 'd') {
 		if (tar) {
 		    params.tar = 1;
-- 
2.30.2






More information about the pbs-devel mailing list