Skip to content

Commit

Permalink
FIX add missing rawurlencode (#11105)
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala authored Feb 12, 2024
1 parent 9c4266c commit b56e771
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,12 +541,12 @@ public function doSave($data, $form)
'Saved {type} "{title}" successfully.',
[
'type' => $this->record->i18n_singular_name(),
'title' => Convert::raw2xml($this->record->Title)
'title' => $this->record->Title
]
);

$controller = $this->getToplevelController();
$controller->getResponse()->addHeader('X-Status', $message);
$controller->getResponse()->addHeader('X-Status', rawurlencode($message));

// Redirect after save
return $this->redirectAfterSave($isNewRecord);
Expand Down Expand Up @@ -779,7 +779,6 @@ protected function saveFormIntoRecord($data, $form)
*/
public function doDelete($data, $form)
{
$title = $this->record->Title;
if (!$this->record->canDelete()) {
throw new ValidationException(
_t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.DeletePermissionsFailure', "No delete permissions")
Expand All @@ -792,7 +791,7 @@ public function doDelete($data, $form)
'Deleted {type} "{name}"',
[
'type' => $this->record->i18n_singular_name(),
'name' => htmlspecialchars($title ?? '', ENT_QUOTES)
'name' => $this->record->Title
]
);

Expand All @@ -807,7 +806,7 @@ public function doDelete($data, $form)
//when an item is deleted, redirect to the parent controller
$controller = $this->getToplevelController();
$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
}
Expand Down

0 comments on commit b56e771

Please sign in to comment.