From 11d24ae9d7693e66f9a8cc5153152cebf20c8dc4 Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Mon, 19 Feb 2024 21:06:01 +0100 Subject: [PATCH] FIX use rawurlencode when setting toast headers (#440) --- src/VersionedGridFieldItemRequest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/VersionedGridFieldItemRequest.php b/src/VersionedGridFieldItemRequest.php index 1b11a56b..4b6c7356 100644 --- a/src/VersionedGridFieldItemRequest.php +++ b/src/VersionedGridFieldItemRequest.php @@ -136,7 +136,7 @@ public function doArchive($data, $form) 'Archived {name} "{title}"', [ 'name' => $record->i18n_singular_name(), - 'title' => Convert::raw2xml($title) + 'title' => $title ] ); $this->setFormMessage($form, $message); @@ -144,7 +144,7 @@ public function doArchive($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 } @@ -188,12 +188,12 @@ public function doPublish($data, $form) 'Published {type} "{title}"', [ 'type' => $record->i18n_singular_name(), - 'title' => Convert::raw2xml($record->Title) + 'title' => $record->Title ] ); $controller = $this->getToplevelController(); - $controller->getResponse()->addHeader('X-Status', $message); + $controller->getResponse()->addHeader('X-Status', rawurlencode($message)); return $this->redirectAfterSave($isNewRecord); } @@ -222,13 +222,13 @@ public function doUnpublish($data, $form) 'Unpublished {name} "{title}"', [ 'name' => $record->i18n_singular_name(), - 'title' => Convert::raw2xml($title) + 'title' => $title ] ); $this->setFormMessage($form, $message); $controller = $this->getToplevelController(); - $controller->getResponse()->addHeader('X-Status', $message); + $controller->getResponse()->addHeader('X-Status', rawurlencode($message)); // Redirect back to edit return $this->redirectAfterSave(false);