M_NOT_YET_UPLOAD and can not override,and change the result asyncupload to pass
This commit is contained in:
@@ -60,6 +60,9 @@ pub(super) fn bad_request_code(kind: &ErrorKind) -> StatusCode {
|
||||
// 429
|
||||
| LimitExceeded { .. } => StatusCode::TOO_MANY_REQUESTS,
|
||||
|
||||
// 409
|
||||
| CannotOverwriteMedia => StatusCode::CONFLICT,
|
||||
|
||||
// 413
|
||||
| TooLarge => StatusCode::PAYLOAD_TOO_LARGE,
|
||||
|
||||
@@ -69,6 +72,9 @@ pub(super) fn bad_request_code(kind: &ErrorKind) -> StatusCode {
|
||||
// 404
|
||||
| NotFound | NotImplemented | FeatureDisabled => StatusCode::NOT_FOUND,
|
||||
|
||||
// 504
|
||||
| NotYetUploaded => StatusCode::GATEWAY_TIMEOUT,
|
||||
|
||||
// 403
|
||||
| GuestAccessForbidden
|
||||
| ThreepidAuthFailed
|
||||
|
||||
@@ -159,6 +159,10 @@ impl Service {
|
||||
) -> Result<()> {
|
||||
let pending = self.db.search_pending_mxc(mxc).await;
|
||||
let Some((owner_id, expires_at)) = pending else {
|
||||
if self.get_metadata(mxc).await.is_some() {
|
||||
return Err!(Request(CannotOverwriteMedia("Media ID already has content")));
|
||||
}
|
||||
|
||||
return Err!(Request(NotFound("Media not found")));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user