From 0f1ddc54a1e194f42248131d1094d86eb01f5aa8 Mon Sep 17 00:00:00 2001
From: Kai Reinhard <K.Reinhard@micromata.de>
Date: Fri, 25 Jan 2019 06:43:19 +0000
Subject: [PATCH] Fix for newUrl if root directory of backup has only one child dir the server steps automatically in.

---
 borgbutler-webapp/src/components/views/archives/FileListPanel.jsx |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/borgbutler-webapp/src/components/views/archives/FileListPanel.jsx b/borgbutler-webapp/src/components/views/archives/FileListPanel.jsx
index dd340da..c040d14 100644
--- a/borgbutler-webapp/src/components/views/archives/FileListPanel.jsx
+++ b/borgbutler-webapp/src/components/views/archives/FileListPanel.jsx
@@ -108,12 +108,13 @@
                 if (fileList && fileList.length > 0 && fileList[0] && fileList[0].path) {
                     const path = fileList[0].path;
                     currentDirectory = path.substring(0, path.length - fileList[0].displayPath.length);
-                    //console.log(fileList[0].path + ", displayPath=" + fileList[0].displayPath + " -> " + currentDirectory);
+                    // console.log(fileList[0].path + ", displayPath=" + fileList[0].displayPath + " -> " + currentDirectory);
 
                     let newUrl = this.props.match.url;
 
                     if (currentDirectory) {
-                        newUrl += `/${currentDirectory}`;
+                        // Avoid double leading slash occurring if top directory of backup has only one single sub directory the server steps automatically in:
+                        newUrl += newUrl.endsWith('/') ? currentDirectory : `/${currentDirectory}`;
                     }
 
                     if (newUrl !== this.props.location.pathname) {

--
Gitblit v1.10.0