Filemanager: Fix anonymous upload directory always reported failure when uploading

This commit is contained in:
nathan 2023-07-24 16:28:31 -06:00
parent 6647381bca
commit 92a166825f
2 changed files with 22 additions and 2 deletions

View File

@ -1791,6 +1791,7 @@ class filemanager_ui
$path = $info['dirname'] . '/'. $info['filename'] . " ($i)." . $info['extension']; $path = $info['dirname'] . '/'. $info['filename'] . " ($i)." . $info['extension'];
$i++; $i++;
} }
$data['path'] = $path;
break; break;
case 'ask': case 'ask':
default: default:

View File

@ -75,9 +75,28 @@ class HiddenUpload extends AnonymousList
$vfs = Vfs::mount(); $vfs = Vfs::mount();
$GLOBALS['egw']->sharing[Sharing::get_token($props['ui_path'])]->redo(); $GLOBALS['egw']->sharing[Sharing::get_token($props['ui_path'])]->redo();
parent::handle_upload_action($action, $selected, $dir, null, $arr); parent::handle_upload_action($action, $selected, $dir, null, $arr);
if ($arr['files'])
// Parent upload action ruins our mount and says the upload failed.
// Do the mount again
$GLOBALS['egw']->sharing[Sharing::get_token($props['ui_path'])]->redo();
// Check ourselves for success
foreach($selected as $filekey => $file_info)
{ {
$arr['msg'] .= "\n" . lang("The uploaded file is only visible to the person sharing these files with you, not to yourself or other people knowing this sharing link."); if(!is_array($file_info))
{
continue;
}
if($arr['uploaded'][$filekey] && Vfs::stat($arr['uploaded'][$filekey]['path']))
{
// success
$arr['files']++;
$arr['errs']--;
}
}
if($arr['files'])
{
$arr['msg'] = lang("The uploaded file is only visible to the person sharing these files with you, not to yourself or other people knowing this sharing link.");
$arr['type'] = 'notice'; $arr['type'] = 'notice';
} }
else else