View Issue Details

IDProjectCategoryView StatusLast Update
0000971bareos-corewebuipublic2021-12-21 13:56
ReporterMasanetz Assigned Tofrank  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSanyOS Version3
Product Version17.2.5 
Summary0000971: Error building tree for filenames with backslashes
DescriptionWebUI Restore fails building the tree if directory contains filenames with backslashes.

Some time ago the adobe reader plugin created a file named "C:\nppdf32Log\debuglog.txt" in the working dir.
Building the restore tree in WebUI fails with popup "Oops, something went wrong, probably too many files.".

Filebname handling for backslashes should be adapted for backslashes (e.g. like https://github.com/bareos/bareos-webui/commit/ee232a6f04eaf2a7c1084fee981f011ede000e8a)
Steps To Reproduce1. Put an empty file with a filename with backslashes (e.g. C:\nppdf32Log\debuglog.txt) in your home directory
2. Backup
3. Try to restore any file from your home directory from this backup via WebUI
Additional InformationAttached diff of my "workaround"
TagsNo tags attached.

Relationships

related to 0001025 closed restore doesn't display certain files and folders 
related to 0001383 closedarogge Release Bareos 18.2.12 
related to 0001384 closedarogge_adm Release Bareos 19.2.11 
related to 0001361 closedarogge Release Bareos 20.0.3 
related to 0001289 closedarogge Release Bareos 21.0.0 

Activities

Masanetz

Masanetz

2018-06-25 11:54

reporter  

RestoreController.php.diff (1,669 bytes)   
diff --git a/module/Restore/src/Restore/Controller/RestoreController.php b/module/Restore/src/Restore/Controller/RestoreController.php
index e4080d9..13b9e87 100644
--- a/module/Restore/src/Restore/Controller/RestoreController.php
+++ b/module/Restore/src/Restore/Controller/RestoreController.php
@@ -346,7 +346,7 @@ class RestoreController extends AbstractActionController
                --$dnum;
                $items .= '{';
                $items .= '"id":"-' . $dir['pathid'] . '"';
-               $items .= ',"text":"' . preg_replace('/[\x00-\x1F\x7F]/', '', str_replace('"', '\"', $dir["name"])) . '"';
+               $items .= ',"text":"' . preg_replace('/[\x00-\x1F\x7F]/', '', str_replace('"', '\"', str_replace('\\', '\\\\', $dir["name"]))) . '"';
                $items .= ',"icon":"glyphicon glyphicon-folder-close"';
                $items .= ',"state":""';
                $items .= ',"data":' . \Zend\Json\Json::encode($dir, \Zend\Json\Json::TYPE_OBJECT);
@@ -369,7 +369,7 @@ class RestoreController extends AbstractActionController
          foreach($this->files as $file) {
             $items .= '{';
             $items .= '"id":"' . $file["fileid"] . '"';
-            $items .= ',"text":"' . preg_replace('/[\x00-\x1F\x7F]/', '', str_replace('"', '\"', $file["name"])) . '"';
+            $items .= ',"text":"' . preg_replace('/[\x00-\x1F\x7F]/', '', str_replace('"', '\"', str_replace('\\', '\\\\', $file["name"]))) . '"';
             $items .= ',"icon":"glyphicon glyphicon-file"';
             $items .= ',"state":""';
             $items .= ',"data":' . \Zend\Json\Json::encode($file, \Zend\Json\Json::TYPE_OBJECT);
RestoreController.php.diff (1,669 bytes)   
frank

frank

2021-07-21 15:22

developer   ~0004184

Fix committed to bareos master branch with changesetid 15067.
frank

frank

2021-07-22 15:22

developer   ~0004189

Fix committed to bareos bareos-19.2 branch with changesetid 15080.

Related Changesets

bareos: master 0df1caaf

2021-07-15 20:14

frank

Ported: N/A

Details Diff
webui: handle filenames containing backslashes properly

Fixes 0000971: Error building tree for filenames with backslashes
Affected Issues
0000971
mod - webui/module/Restore/src/Restore/Controller/RestoreController.php Diff File

bareos: bareos-19.2 cabfa11c

2021-07-15 20:14

frank

Ported: N/A

Details Diff
webui: handle filenames containing backslashes properly

Fixes 0000971: Error building tree for filenames with backslashes

(cherry picked from commit 0df1caafed8428ad531a2b8a5a7b5a2e054d0f22)
Affected Issues
0000971
mod - webui/module/Restore/src/Restore/Controller/RestoreController.php Diff File

bareos: bareos-18.2 861f6189

2021-07-21 18:29

frank

Ported: N/A

Details Diff
webui: handle filenames containing backslashes properly

Fixes 0000971: Error building tree for filenames with backslashes
Affected Issues
0000971
mod - webui/module/Restore/src/Restore/Controller/RestoreController.php Diff File

bareos: bareos-19.2 a3873fec

2021-07-22 16:54

frank


Committer: GitHub

Ported: N/A

Details Diff
Merge pull request 0000895 from bareos/dev/fbergkemper/bareos-19.2/backport-971-1020

webui: backport to fix issue 0000971 and issue 0001020
Affected Issues
0000971, 0001020
mod - webui/module/Restore/src/Restore/Controller/RestoreController.php Diff File
mod - webui/vendor/Bareos/library/Bareos/BSock/BareosBSock.php Diff File

bareos: bareos-18.2 7fc53502

2021-07-22 16:55

frank


Committer: GitHub

Ported: N/A

Details Diff
Merge pull request 0000896 from bareos/dev/fbergkemper/bareos-18.2/backport-971-1020

webui: backport to fix issue 0000971 and issue 0001020
Affected Issues
0000971, 0001020
mod - webui/module/Restore/src/Restore/Controller/RestoreController.php Diff File
mod - webui/vendor/Bareos/library/Bareos/BSock/BareosBSock.php Diff File

Issue History

Date Modified Username Field Change
2018-06-25 11:54 Masanetz New Issue
2018-06-25 11:54 Masanetz File Added: RestoreController.php.diff
2018-10-10 11:16 frank Status new => assigned
2018-10-10 11:16 frank Assigned To => frank
2021-07-15 18:17 frank Status assigned => confirmed
2021-07-15 18:19 frank Summary Restore WebUI - Error building tree for filenames with backslashes => Error building tree for filenames with backslashes
2021-07-21 15:22 frank Changeset attached => bareos master 0df1caaf
2021-07-21 15:22 frank Note Added: 0004184
2021-07-21 15:22 frank Status confirmed => resolved
2021-07-21 15:22 frank Resolution open => fixed
2021-07-22 15:22 frank Changeset attached => bareos bareos-18.2 7fc53502
2021-07-22 15:22 frank Changeset attached => bareos bareos-18.2 861f6189
2021-07-22 15:22 frank Changeset attached => bareos bareos-19.2 a3873fec
2021-07-22 15:22 frank Changeset attached => bareos bareos-19.2 cabfa11c
2021-07-22 15:22 frank Note Added: 0004189
2021-07-26 10:36 frank Relationship added related to 0001025
2021-09-13 10:37 arogge Relationship added related to 0001383
2021-09-14 10:54 arogge_adm Relationship added related to 0001384
2021-09-14 12:19 arogge_adm Relationship added related to 0001361
2021-12-21 13:56 arogge Relationship added related to 0001289