Display more detailed error message when upload info mismatch is found

This commit is contained in:
Kijin Sung 2023-11-03 16:48:46 +09:00
parent 990343d906
commit 27a932d594
3 changed files with 8 additions and 8 deletions

View file

@ -36,11 +36,11 @@ class FileController extends File
$module_srl = $this->module_srl;
if (empty($_SESSION['upload_info'][$editor_sequence]->enabled))
{
throw new Rhymix\Framework\Exceptions\InvalidRequest('file.msg_invalid_upload_info');
throw new Rhymix\Framework\Exceptions\InvalidRequest(sprintf(lang('file.msg_invalid_upload_info'), 'editor_sequence'));
}
if ($_SESSION['upload_info'][$editor_sequence]->module_srl !== $module_srl)
{
throw new Rhymix\Framework\Exceptions\InvalidRequest('file.msg_invalid_upload_info');
throw new Rhymix\Framework\Exceptions\InvalidRequest(sprintf(lang('file.msg_invalid_upload_info'), 'module_srl'));
}
// Validate upload_target_srl.
@ -48,7 +48,7 @@ class FileController extends File
$submitted_upload_target_srl = intval(Context::get('uploadTargetSrl')) ?: intval(Context::get('upload_target_srl'));
if ($submitted_upload_target_srl && $submitted_upload_target_srl !== intval($upload_target_srl))
{
throw new Rhymix\Framework\Exceptions\InvalidRequest('file.msg_invalid_upload_info');
throw new Rhymix\Framework\Exceptions\InvalidRequest(sprintf(lang('file.msg_invalid_upload_info'), 'upload_target_srl'));
}
if (!$upload_target_srl)
{
@ -180,11 +180,11 @@ class FileController extends File
$module_srl = $this->module_srl;
if (empty($_SESSION['upload_info'][$editor_sequence]->enabled))
{
throw new Rhymix\Framework\Exceptions\InvalidRequest('file.msg_invalid_upload_info');
throw new Rhymix\Framework\Exceptions\InvalidRequest(sprintf(lang('file.msg_invalid_upload_info'), 'editor_sequence'));
}
if ($_SESSION['upload_info'][$editor_sequence]->module_srl !== $module_srl)
{
throw new Rhymix\Framework\Exceptions\InvalidRequest('file.msg_invalid_upload_info');
throw new Rhymix\Framework\Exceptions\InvalidRequest(sprintf(lang('file.msg_invalid_upload_info'), 'module_srl'));
}
// Get upload_target_srl
@ -192,7 +192,7 @@ class FileController extends File
$submitted_upload_target_srl = intval(Context::get('uploadTargetSrl')) ?: intval(Context::get('upload_target_srl'));
if ($submitted_upload_target_srl && $submitted_upload_target_srl !== intval($upload_target_srl))
{
throw new Rhymix\Framework\Exceptions\InvalidRequest('file.msg_invalid_upload_info');
throw new Rhymix\Framework\Exceptions\InvalidRequest(sprintf(lang('file.msg_invalid_upload_info'), 'upload_target_srl'));
}
if (!$upload_target_srl)
{