core icon indicating copy to clipboard operation
core copied to clipboard

Undefined index warning when restoring multiple files from trashbin

Open mrow4a opened this issue 1 year ago • 7 comments

I see in the logs Undefined index: files at /var/www/owncloud/apps/files_trashbin/ajax/undelete.php#31 when using feature in trashbin that user can select multiple files and delete at once.

related: https://github.com/owncloud/enterprise/issues/5222#issuecomment-1190809708

mrow4a avatar Jul 26 '22 18:07 mrow4a

@pmaier1 fyi comment from holger https://github.com/owncloud/enterprise/issues/5222#issuecomment-1191769523 , not sure how to handle the tracking for this and prio

mrow4a avatar Jul 26 '22 18:07 mrow4a

@mrow4a we need some more information here

NannaBarz avatar Aug 01 '22 08:08 NannaBarz

@NannaBarz what kind of information? This is warning that some variable is accessed but is not being set. Some code is out of sync on client and server. I did not see any other bug related to it, but it could lead to some problem (as is definition of warning)

mrow4a avatar Aug 01 '22 08:08 mrow4a

@mrow4a wouldn't just be enough to check if the variable is set, like changing https://github.com/owncloud/core/blob/master/apps/files_trashbin/ajax/undelete.php#L31 to:

$files = isset($_POST['files']) ? $_POST['files'] : '';

pako81 avatar Aug 04 '22 11:08 pako81

I rather though on why it is there in a first place. Otherwise we could be curing broken leg with painkiller. Feels good but leg is still broken.

mrow4a avatar Aug 04 '22 11:08 mrow4a

btw, moving https://github.com/owncloud/core/blob/master/apps/files_trashbin/ajax/undelete.php#L31 just before https://github.com/owncloud/core/blob/master/apps/files_trashbin/ajax/undelete.php#L52 seems to do the trick.

https://github.com/owncloud/core/blob/master/apps/files_trashbin/ajax/delete.php is implemented the same way.

pako81 avatar Aug 04 '22 13:08 pako81

@pako81 just a little bit dived, yes you are right. this would be the correct fix!

mrow4a avatar Aug 05 '22 05:08 mrow4a

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 02 '23 01:02 github-actions[bot]

This issue has been automatically closed.

github-actions[bot] avatar Feb 12 '23 01:02 github-actions[bot]