This was requested because of 0px thumbnail requests, but there are
other cases where parameters are detected as invalid and 400 is
semantically more correct than 500 in that situation.
Bug: T147784
Change-Id: I4d24a93e655f04d8119e77798d5df5a45caaafcf
function isError() {
return true;
}
+
+ function getHttpStatusCode() {
+ return 500;
+ }
}
/**
max( isset( $params['height'] ) ? $params['height'] : 0, 120 ),
wfMessage( 'thumbnail_invalid_params' )->text() );
}
+
+ function getHttpStatusCode() {
+ return 400;
+ }
}
/**
)->text()
);
}
+
+ function getHttpStatusCode() {
+ return 400;
+ }
}
// Check for thumbnail generation errors...
$msg = wfMessage( 'thumbnail_error' );
$errorCode = 500;
+
if ( !$thumb ) {
$errorMsg = $errorMsg ?: $msg->rawParams( 'File::transform() returned false' )->escaped();
if ( $errorMsg instanceof MessageSpecifier &&
}
} elseif ( $thumb->isError() ) {
$errorMsg = $thumb->getHtmlMsg();
+ $errorCode = $thumb->getHttpStatusCode();
} elseif ( !$thumb->hasFile() ) {
$errorMsg = $msg->rawParams( 'No path supplied in thumbnail object' )->escaped();
} elseif ( $thumb->fileIsSource() ) {