View Issue Details

IDProjectCategoryView StatusLast Update
0000973bareos-corewebuipublic2019-12-18 15:25
Reporterjhon Assigned Toaron_s 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionopen 
PlatformLinuxOSCentOSOS Version7
Product Version18.3.1 
Summary0000973: WEBUI Restore Too Many Files error caused by bad JSON [issue present at least from 17.2.4]
DescriptionI solved this issue on my 17.2.4 install but when I looked at the code in the master, I saw that this issues was "fixed". However, the "fix" in the master is not good and will also cause bad JSON to be uploaded to the webui causing the "too many files" error box.
Steps To ReproduceFor the current master branch:
- go to the restore ui
- try to open a directory without subdirectories.

For the 17.2.4 version:
- go to the restore UI
- try to open a directory containing one directory and multiple files.

Additional InformationFor the current master, the issue is on line 361 of /master/webui/module/Restore/src/Restore/Controller/RestoreController.php

[https://github.com/bareos/bareos/blob/master/webui/module/Restore/src/Restore/Controller/RestoreController.php]

This line is now:
if($fnum > 0) {

This does not take into account the case when there are no subdirs in this subtree and will add a stray comma before the files json elements, causing an error in the browser.

Changing this line to
if( $tmp > 0 && $fnum > 0 ) {

solves the problem. ($tmp is set to $dnum and holds the number of directories in the subtree.

---

Additional info:

In the 17.2.4 branch, this line is actually different, but also wrong:
if( $tmp > 2 && $fnum > 0 ) {

The $tmp > 2 is wrong since directories with only 1 or 2 subdirs won't get the comma added and a JSON error complaining about that will result.
I suspect the current state of the file in master is a result of someone "fixing" this problem incorrectly.
TagsNo tags attached.

Activities

aron_s

aron_s

2018-08-08 13:09

reporter   ~0003095

Thank you for the report and the already fixed line.
I tested this and submitted a PR against our master branch.
Furthermore I'd like to encourage you to just open a pull request yourself the next time.
That case is likely to be handled much faster than opening a bug report here!

Issue History

Date Modified Username Field Change
2018-06-28 11:19 jhon New Issue
2018-08-07 14:01 aron_s Assigned To => aron_s
2018-08-07 14:01 aron_s Status new => assigned
2018-08-08 13:09 aron_s Note Added: 0003095
2018-08-08 13:09 aron_s Status assigned => resolved
2019-12-18 15:25 arogge Status resolved => closed