Permalink
Browse files

Fix to bugreport #905 and #893

Regarding #905:

When returning an Ajax result, inside a json string value don't use addslashes.
You don't want both " and ' escaped at the same time. Instead just use
str_replace('"','\"',$Str).

Regarding #893:

A misplaced dir and file separator ',' lead to malformed json which could result in
a non loadable subtree.

Fixes #893: webui cannot list dirs with only files in them
Fixes #905: Restore WebUI - Enable to browse directory when a file name contain a single quote
  • Loading branch information...
fbergkemper committed Feb 13, 2018
1 parent 85483ba commit ee232a6f04eaf2a7c1084fee981f011ede000e8a
Showing with 5 additions and 5 deletions.
  1. +5 −5 module/Restore/src/Restore/Controller/RestoreController.php
@@ -346,7 +346,7 @@ private function buildSubtree()
--$dnum;
$items .= '{';
$items .= '"id":"-' . $dir['pathid'] . '"';
$items .= ',"text":"' . preg_replace('/[\x00-\x1F\x7F]/', '', $dir["name"]) . '"';
$items .= ',"text":"' . preg_replace('/[\x00-\x1F\x7F]/', '', str_replace('"', '\"', $dir["name"])) . '"';
$items .= ',"icon":"glyphicon glyphicon-folder-close"';
$items .= ',"state":""';
$items .= ',"data":' . \Zend\Json\Json::encode($dir, \Zend\Json\Json::TYPE_OBJECT);
@@ -358,18 +358,18 @@ private function buildSubtree()
}
}
}
if($fnum > 0) {
$items .= ",";
}
if( $tmp > 2 && $fnum > 0 ) {
$items .= ",";
}
if($fnum > 0) {
foreach($this->files as $file) {
$items .= '{';
$items .= '"id":"' . $file["fileid"] . '"';
$items .= ',"text":"' . preg_replace('/[\x00-\x1F\x7F]/', '', addslashes($file["name"])) . '"';
$items .= ',"text":"' . preg_replace('/[\x00-\x1F\x7F]/', '', str_replace('"', '\"', $file["name"])) . '"';
$items .= ',"icon":"glyphicon glyphicon-file"';
$items .= ',"state":""';
$items .= ',"data":' . \Zend\Json\Json::encode($file, \Zend\Json\Json::TYPE_OBJECT);

1 comment on commit ee232a6

@Udhayakumar2201

This comment has been minimized.

Udhayakumar2201 commented on ee232a6 Jul 14, 2018

Hi...
After modify this file same as Bareos webui Restore tab take too much time for particular client backup.
for your information that back up file size only 500 MB.
Please advice me to fix this issue.

Thanks in Advance.
Udhayakumar R

Please sign in to comment.