FIX add missing rawurlencode (#11105)

This commit is contained in:
Thomas Portelange 2024-02-12 22:08:28 +01:00 committed by GitHub
parent 9c4266c8f3
commit b56e771ed5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -541,12 +541,12 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
'Saved {type} "{title}" successfully.', 'Saved {type} "{title}" successfully.',
[ [
'type' => $this->record->i18n_singular_name(), 'type' => $this->record->i18n_singular_name(),
'title' => Convert::raw2xml($this->record->Title) 'title' => $this->record->Title
] ]
); );
$controller = $this->getToplevelController(); $controller = $this->getToplevelController();
$controller->getResponse()->addHeader('X-Status', $message); $controller->getResponse()->addHeader('X-Status', rawurlencode($message));
// Redirect after save // Redirect after save
return $this->redirectAfterSave($isNewRecord); return $this->redirectAfterSave($isNewRecord);
@ -779,7 +779,6 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
*/ */
public function doDelete($data, $form) public function doDelete($data, $form)
{ {
$title = $this->record->Title;
if (!$this->record->canDelete()) { if (!$this->record->canDelete()) {
throw new ValidationException( throw new ValidationException(
_t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.DeletePermissionsFailure', "No delete permissions") _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.DeletePermissionsFailure', "No delete permissions")
@ -792,7 +791,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
'Deleted {type} "{name}"', 'Deleted {type} "{name}"',
[ [
'type' => $this->record->i18n_singular_name(), 'type' => $this->record->i18n_singular_name(),
'name' => htmlspecialchars($title ?? '', ENT_QUOTES) 'name' => $this->record->Title
] ]
); );
@ -807,7 +806,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
//when an item is deleted, redirect to the parent controller //when an item is deleted, redirect to the parent controller
$controller = $this->getToplevelController(); $controller = $this->getToplevelController();
$controller->getRequest()->addHeader('X-Pjax', 'Content'); // Force a content refresh $controller->getRequest()->addHeader('X-Pjax', 'Content'); // Force a content refresh
$controller->getResponse()->addHeader('X-Status', $message); $controller->getResponse()->addHeader('X-Status', rawurlencode($message));
return $controller->redirect($this->getBackLink(), 302); //redirect back to admin section return $controller->redirect($this->getBackLink(), 302); //redirect back to admin section
} }