From d420a29e9f3af35412624e4068e90f80427fa672 Mon Sep 17 00:00:00 2001 From: Niklas Forsdahl Date: Tue, 28 Jun 2022 05:51:05 +0300 Subject: [PATCH] FIX Row updating broken in SilverStripe 4 (#197) Row updating is broken in SilverStripe 4 when for example using the PublishHandler or UnPublishHandler actions. This is due to unescaped backslashes in the fully qualified class name in json data, which when parsed in javascript treats the backslash as an escape character. This can be fixed by escaping the backslash character in HTTPBulkToolsResponse. --- src/BulkTools/HTTPBulkToolsResponse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BulkTools/HTTPBulkToolsResponse.php b/src/BulkTools/HTTPBulkToolsResponse.php index f99a4ea..7a2ee3d 100644 --- a/src/BulkTools/HTTPBulkToolsResponse.php +++ b/src/BulkTools/HTTPBulkToolsResponse.php @@ -334,7 +334,7 @@ class HTTPBulkToolsResponse extends HTTPResponse ); foreach ($this->successRecords as $record) { - $data = array('id' => $record->ID, 'class' => $record->ClassName); + $data = array('id' => $record->ID, 'class' => str_replace('\\', '\\\\', $record->ClassName)); if (!$this->removesRows) { $data['row'] = $this->getRecordGridfieldRow($record); }