mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: return a meaningful translatable string when resource is invalid
This commit is contained in:
parent
bb29ff3611
commit
63ed0cba32
@ -810,7 +810,17 @@ class HtmlEditorField_Embed extends HtmlEditorField_File {
|
||||
parent::__construct($url, $file);
|
||||
$this->oembed = Oembed::get_oembed_from_url($url);
|
||||
if(!$this->oembed) {
|
||||
return Controller::curr()->httpError(404, 'The URL ' . $url . ' could not be turned into a media resource.');
|
||||
$controller = Controller::curr();
|
||||
$controller->response->addHeader('X-Status',
|
||||
rawurlencode(_t(
|
||||
'HtmlEditorField.URLNOTANOEMBEDRESOURCE',
|
||||
"The URL '{url}' could not be turned into a media resource.",
|
||||
"The URL that has been passed is not a valid Oembed resource, and the embed element could not be created.",
|
||||
array('url' => $url)
|
||||
)));
|
||||
$controller->response->setStatusCode(404);
|
||||
|
||||
throw new SS_HTTPResponse_Exception($controller->response);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user