forked from GNUsocial/gnu-social
Detect "no file" upload error and, for now at least, ignore it gracefully.
This was triggering on non-AJAX form submissions for new notices, preventing them from being posted when they contained no attachments.
This commit is contained in:
parent
b579a306c7
commit
73b9e531bf
@ -79,7 +79,12 @@ class ImageFile
|
|||||||
@unlink($_FILES[$param]['tmp_name']);
|
@unlink($_FILES[$param]['tmp_name']);
|
||||||
throw new Exception(_('Partial upload.'));
|
throw new Exception(_('Partial upload.'));
|
||||||
return;
|
return;
|
||||||
|
case UPLOAD_ERR_NO_FILE:
|
||||||
|
// No file; probably just a non-AJAX submission.
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
|
common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
|
||||||
|
$_FILES[$param]['error']);
|
||||||
throw new Exception(_('System error uploading file.'));
|
throw new Exception(_('System error uploading file.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,9 @@ class MediaFile
|
|||||||
throw new ClientException(_('The uploaded file was only' .
|
throw new ClientException(_('The uploaded file was only' .
|
||||||
' partially uploaded.'));
|
' partially uploaded.'));
|
||||||
return;
|
return;
|
||||||
|
case UPLOAD_ERR_NO_FILE:
|
||||||
|
// No file; probably just a non-AJAX submission.
|
||||||
|
return;
|
||||||
case UPLOAD_ERR_NO_TMP_DIR:
|
case UPLOAD_ERR_NO_TMP_DIR:
|
||||||
throw new ClientException(_('Missing a temporary folder.'));
|
throw new ClientException(_('Missing a temporary folder.'));
|
||||||
return;
|
return;
|
||||||
@ -162,6 +165,8 @@ class MediaFile
|
|||||||
throw new ClientException(_('File upload stopped by extension.'));
|
throw new ClientException(_('File upload stopped by extension.'));
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
|
||||||
|
$_FILES[$param]['error']);
|
||||||
throw new ClientException(_('System error uploading file.'));
|
throw new ClientException(_('System error uploading file.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user