New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Special characters in tags field saved escaped when selected using autocomplete #4043
Comments
It also happens with |
Do you know when there will be a fix available? My client is filling their website with content and saving dozens of entries with wrong data. 🥴 |
This bug was introduced in version 3.6.0. |
Issue summaryStatus quoThis issue occurs because we use kirby/src/Form/OptionsQuery.php Lines 128 to 129 in 351b634
kirby/src/Form/OptionsQuery.php Lines 93 to 106 in 351b634
Because the Rough solution draftThe issue can be solved by only using diff --git a/src/Form/OptionsQuery.php b/src/Form/OptionsQuery.php
index ba4660f7..be71cfb5 100644
--- a/src/Form/OptionsQuery.php
+++ b/src/Form/OptionsQuery.php
@@ -86,11 +86,10 @@ class OptionsQuery
/**
* @param string $object
* @param string $field
- * @param array $data
* @return string
* @throws \Kirby\Exception\NotFoundException
*/
- protected function template(string $object, string $field, array $data)
+ protected function templateValue(string $object, string $field)
{
$value = $this->$field();
@@ -102,7 +101,7 @@ class OptionsQuery
$value = $value[$object];
}
- return Str::safeTemplate($value, $data);
+ return $value;
}
/**
@@ -125,8 +124,8 @@ class OptionsQuery
$data = array_merge($data, [$alias => $item]);
$options[] = [
- 'text' => $this->template($alias, 'text', $data),
- 'value' => $this->template($alias, 'value', $data)
+ 'text' => Str::safeTemplate($this->templateValue($alias, 'text'), $data),
+ 'value' => Str::template($this->templateValue($alias, 'value'), $data)
];
} This can be a possible temporary fix for you @silllli if you are not affected by the side effects below. Side effects
Summary
|
We use the standard Current state of refactoring the backend: develop...lab/nico/4043-options-escape |
Shouldn't the |
Can confirm that this also exists in a 3.7 (3.7.0.1). |
✅ |
Description
I have a tags field that gets its options from a query:
When I save a tag featuring an ampersand (e. g. “Riese & Müller“) it gets saved correctly. But when I then go to a sibling page and select that same value from the autocomplete options, it’s getting saved and output as
Riese & Müller
.Expected behavior
The value being saved just like the original.
To reproduce
Your setup
Kirby Version
3.6.1.1
Console output
Your system (please complete the following information)
Maybe related to #4041.
The text was updated successfully, but these errors were encountered: