N°6600 Portal download attachment : don't display anymore SQL query on attachment not found error (#525)

This commit is contained in:
Pierre Goiffon
2023-09-19 09:54:43 +02:00
committed by GitHub
parent 0a6c82dfe1
commit e5dd51f637
2 changed files with 12 additions and 2 deletions

View File

@@ -1035,7 +1035,11 @@ class ObjectController extends BrickController
// When reaching to an Attachment, we have to check security on its host object instead of the Attachment itself
if ($sObjectClass === 'Attachment')
{
$oAttachment = MetaModel::GetObject($sObjectClass, $sObjectId, true, true);
$oAttachment = MetaModel::GetObject($sObjectClass, $sObjectId, false, true);
if ($oAttachment === null) {
throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist'));
}
$sHostClass = $oAttachment->Get('item_class');
$sHostId = $oAttachment->Get('item_id');
}