[pbs-devel] [PATCH v9 proxmox-backup 54/58] www: content: lookup via metadata archive instead of catalog

Christian Ebner c.ebner at proxmox.com
Wed Jun 5 12:54:12 CEST 2024


In case of pxar archives with split metadata and payload data, the
metadata archive has to be used to lookup entries for navigation
before performing a single file restore.

Decide based on the archive filename extension whether to use the
`catalog` or the `pxar-lookup` api endpoint.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 8:
- not present in previous version

 www/datastore/Content.js | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/www/datastore/Content.js b/www/datastore/Content.js
index 6dd1ab319..f3ff3998c 100644
--- a/www/datastore/Content.js
+++ b/www/datastore/Content.js
@@ -789,15 +789,28 @@ Ext.define('PBS.DataStoreContent', {
 	    if (view.namespace && view.namespace !== '') {
 		extraParams.ns = view.namespace;
 	    }
-	    Ext.create('Proxmox.window.FileBrowser', {
-		title: `${type}/${id}/${timetext}`,
-		listURL: `/api2/json/admin/datastore/${view.datastore}/catalog`,
-		downloadURL: `/api2/json/admin/datastore/${view.datastore}/pxar-file-download`,
-		extraParams,
-		enableTar: true,
-		downloadPrefix: `${type}-${id}-`,
-		archive: rec.data.filename,
-	    }).show();
+
+	    if (rec.data.filename.endsWith(".mpxar.didx")) {
+		extraParams['archive-name'] = btoa(rec.data.filename);
+		Ext.create('Proxmox.window.FileBrowser', {
+		    title: `${type}/${id}/${timetext}`,
+		    listURL: `/api2/json/admin/datastore/${view.datastore}/pxar-lookup`,
+		    downloadURL: `/api2/json/admin/datastore/${view.datastore}/pxar-file-download`,
+		    extraParams,
+		    enableTar: true,
+		    downloadPrefix: `${type}-${id}-`,
+		    archive: rec.data.filename,
+		}).show();
+	    } else {
+		Ext.create('Proxmox.window.FileBrowser', {
+		    title: `${type}/${id}/${timetext}`,
+		    listURL: `/api2/json/admin/datastore/${view.datastore}/catalog`,
+		    downloadURL: `/api2/json/admin/datastore/${view.datastore}/pxar-file-download`,
+		    extraParams,
+		    enableTar: true,
+		    downloadPrefix: `${type}-${id}-`,
+		}).show();
+	    }
 	},
 
 	filter: function(item, value) {
-- 
2.39.2





More information about the pbs-devel mailing list