\r\n on the config form causes the property_restrictions to not be followed

Created on 16 July 2025, 5 days ago

Problem/Motivation

We currently have a system where you can add property restrictions to the agents. These have the possibility to set values that matches with multiple values via newline.

So if you want for instance to add so that the agent is only able to change the content types article and page, but nothing else you would put the following into the value

article
page

The logic that exists in AiAgentsForm is to explode this on "\n", but the problem that happens is that config textareas by default adds "\r\n" when it gets saved, so it adds "\r". This means that the check will be against "article\r" and "page" - meaning that it will never allow article in this case and fail.

There is a core issue to fix this, but its still not added 📌 Add Textarea option to normalize newlines to \n Needs review .

Steps to reproduce

Create an agent and set "Only allow certain values" and two values.
Try to ask the agent to use the second value - it will never work, because it doesn't match it.

Proposed resolution

  1. Add so that this gets cleaned up on saving, similar to how we solved it in 📌 Remove \r so that exported agents have literal block scalar Active .
  2. Write an update hook that resaves all configurations.
  3. Write tests to make sure that this works correctly and so we do not get regression.
  4. Add a follow up to remove this custom logic when 📌 Add Textarea option to normalize newlines to \n Needs review is fixed.
🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇩🇪Germany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024