\r\n on the config form causes the property_restrictions to not be followed
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3536318. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !162 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>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.</p> <p>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</p> <pre>article<br>page</pre><p>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.</p> <p>There is a core issue to fix this, but its still not added <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-13"><a href="https://www.drupal.org/project/drupal/issues/3202631" title="Status: Needs work">#3202631: Add Textarea option to normalize newlines to \n</a></span>.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Create an agent and set "Only allow certain values" and two values.<br> Try to ask the agent to use the second value - it will never work, because it doesn't match it.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ol> <li>Add so that this gets cleaned up on saving, similar to how we solved it in <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/ai_agents/issues/3535525" title="Status: Closed (fixed)">#3535525: Remove \r so that exported agents have literal block scalar</a></span>.</li> <li>Write an update hook that resaves all configurations.</li> <li>Write tests to make sure that this works correctly and so we do not get regression.</li> <li>Add a follow up to remove this custom logic when <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-13"><a href="https://www.drupal.org/project/drupal/issues/3202631" title="Status: Needs work">#3202631: Add Textarea option to normalize newlines to \n</a></span> is fixed.</li> <li>Also add checks for empty fields</li> <li>Also add this for default information tools</li> </ol> > Related issue: [Issue #3239878](https://www.drupal.org/node/3239878) > Related issue: [Issue #3535525](https://www.drupal.org/node/3535525)
issue