Fix HiddenUpload shares fail to complete the upload

This commit is contained in:
nathan 2022-10-11 10:19:30 -06:00
parent 075ba0f330
commit c9eaeb51ea
2 changed files with 14 additions and 4 deletions

View File

@ -1314,9 +1314,12 @@ export class filemanagerAPP extends EgwApp
* Check if a row can have the Hidden Uploads action
* Needs to be a directory
*/
hidden_upload_enabled(_action: egwAction, _senders: egwActionObject[])
hidden_upload_enabled(_action : egwAction, _senders : egwActionObject[])
{
if (_senders[0].id == 'nm') return false;
if(_senders[0].id == 'nm')
{
return false;
}
let data = egw.dataGetUIDdata(_senders[0].id);
let readonly = (data?.data.class || '').split(/ +/).indexOf('noEdit') >= 0;
@ -1324,6 +1327,12 @@ export class filemanagerAPP extends EgwApp
return (!_senders[0].id || data.data.is_dir && !readonly);
}
hiddenUploadOnOne(event)
{
let path = event.data?.options?.uploadPath || this.get_path() + "/Upload";
this.upload(event, 1, '/Shared dir/Upload', 'rename', 'EGroupware\\Filemanager\\Sharing\\HiddenUpload::ajax_action');
}
/**
* View the link from an existing share
* (EPL only)

View File

@ -49,8 +49,9 @@ class HiddenUpload extends AnonymousList
// Take over upload, change target and conflict strategy
$path = Vfs::concat(self::get_home_dir(), Sharing::HIDDEN_UPLOAD_DIR);
$target = str_replace('\\', '\\\\', __CLASS__);
$this->etemplate->setElementAttribute('nm[upload]', 'onFinishOne', "app.filemanager.upload(ev, 1, '$path', 'rename', '{$target}::ajax_action')");
$this->etemplate->setElementAttribute('nm[upload]', 'onFinishOne', "app.filemanager.hiddenUploadOnOne");
// Not a real attribute, but we need to make sure we always upload to the correct place
$this->etemplate->setElementAttribute('nm[upload]', 'uploadPath', $path);
}
return parent::listview($content, $msg);