View Issue Details

IDProjectCategoryView StatusLast Update
0000905bareos-corewebuipublic2019-12-18 15:25
Reporterstephane Assigned Tofrank  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformWindows 8OSWindowsOS Version8
Product Version17.2.4 
Summary0000905: Restore WebUI - Enable to browse directory when a file name contain a single quote
DescriptionIn the restore menu select a job and browse accross directory with a file contain a single quote , it say "Oops, something went wrong, probably too many files."

in the file Restore/src/Restore/Controller/RestoreController.php in Buildsubtree function for a file, the addslaches function escape the file name for the "text" value :
…{"id":"194117","text":"l\'aurore.txt","icon":"glyphicon glyphicon-file","state":"","data":{"lstat":"A A IH\/ B A A g J A A BafE\/H BafE\/m BafFJS A A L","type":"F","linkfileindex":0,"pathid":6335,"stat":{"atime":1518096327,"dev":0,"size":9,"ino":0,"mode":33279,"nlink":1,"user":"root","group":"root","rdev":32,"mtime":1518096358,"ctime":1518096978},"fileid":194117,"jobid":62,"name":"l\u0027aurore.txt"}}…

without the addslashes function json is ok and you can browse the directory:

{"id":"194117","text":"l'aurore.txt","icon":"glyphicon glyphicon-file","state":"","data":{"lstat":"A A IH\/ B A A g J A A BafE\/H BafE\/m BafFJS A A L","type":"F","linkfileindex":0,"pathid":6335,"stat":{"atime":1518096327,"dev":0,"size":9,"ino":0,"mode":33279,"nlink":1,"user":"root","group":"root","rdev":32,"mtime":1518096358,"ctime":1518096978},"fileid":194117,"jobid":62,"name":"l\u0027aurore.txt"}

regards
TagsNo tags attached.

Relationships

child of 0000910 closed Release bareos-17.2.5 

Activities

frank

frank

2018-02-13 18:52

developer   ~0002910

Fix committed to bareos-webui bareos-17.2 branch with changesetid 7738.

Related Changesets

bareos-webui: bareos-17.2 ee232a6f

2018-02-13 19:43

frank

Ported: N/A

Details Diff
Fix to bugreport 0000905 and 0000893

Regarding 0000905:

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 0000893:

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

Fixes 0000893: webui cannot list dirs with only files in them
Fixes 0000905: Restore WebUI - Enable to browse directory when a file name contain a single quote
Affected Issues
0000893, 0000905
mod - module/Restore/src/Restore/Controller/RestoreController.php Diff File

Issue History

Date Modified Username Field Change
2018-02-08 16:09 stephane New Issue
2018-02-08 18:13 joergs Assigned To => frank
2018-02-08 18:13 joergs Status new => assigned
2018-02-13 18:16 frank Status assigned => confirmed
2018-02-13 18:52 frank Changeset attached => bareos-webui bareos-17.2 ee232a6f
2018-02-13 18:52 frank Note Added: 0002910
2018-02-13 18:52 frank Status confirmed => resolved
2018-02-13 18:52 frank Resolution open => fixed
2018-02-13 18:56 frank Relationship added child of 0000910
2019-12-18 15:25 arogge Status resolved => closed