Skip to content
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

BUGFIX: Trim leading and tailing whitespaces #3860

Merged
merged 6 commits into from
Oct 10, 2024

Conversation

markusguenther
Copy link
Member

Whitespaces like a tab can lead to a 404 error if a URL has been pasted to a LinkEditor or LinkInput.

As data sources, assets, URLs and slugs should not start with a whitespace, we can remove them.

Fixes: #3859

Whitespaces like a tab can lead to a 404 error if a URL has been pasted to a LinkEditor or LinkInput.

As datasources, assets, URLs and slugs should not start with a whitespace, we can remove them.

Fixes: neos#3859
@github-actions github-actions bot added Bug Label to mark the change as bugfix 8.3 labels Sep 26, 2024
@markusguenther
Copy link
Member Author

markusguenther commented Sep 26, 2024

If I missed something, please let me know. Also thought about an editor option to trim that, but that would be more a feature than a bug fix then.

trimed-link.mp4

Ensure that searchTerm is a string before trimming the value.
@markusguenther
Copy link
Member Author

The acceptance tests will run when #3855 has been merged. At the moment they are broken.

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me by reading, thx!

@pKallert
Copy link
Contributor

pKallert commented Oct 2, 2024

Thanks for having a look!
I tried it out, but it only works when entering something by hand. Copy/pasting a URL with tab/space still saves with the space.

@markusguenther
Copy link
Member Author

Thanks for having a look! I tried it out, but it only works when entering something by hand. Copy/pasting a URL with tab/space still saves with the space.

Will test it again, but also used the Clipboard.

@markusguenther
Copy link
Member Author

@pKallert Don't know why it worked before for me 🙈. Thanks for the test and review.

@markusguenther
Copy link
Member Author

markusguenther commented Oct 8, 2024

Ok , as the handleSearchTermChange is called on each keystroke we trim also spaces while entering text, so I now just trim the beginning at this point and when the Link should be applied manually we know that nothing should change anymore, so I can also trim the tailing whitespaces.

Hope that we now have a solution that works for all cases 🙈

@markusguenther
Copy link
Member Author

Finally, tests are also passing 🥳

Copy link
Contributor

@pKallert pKallert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm, thank you!

@Sebobo Sebobo merged commit f0ac8f1 into neos:8.3 Oct 10, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.3 Bug Label to mark the change as bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants