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

Docs: Specify the string length limitation when verifying paste patterns #2855

Open
asebert-caue opened this issue Oct 25, 2024 · 3 comments

Comments

@asebert-caue
Copy link

Hello,
While integrating my own service with the embed tool, I noticed that there is a 450-character limitation for paste patterns.
Link to the relevant code line
I have opened an issue: GitHub Issue #135
I am not sure if this limitation is intentional or not, but I think it would be beneficial to have the ability to adjust this limit.

@neSpecc
Copy link
Member

neSpecc commented Oct 25, 2024

Regex checking is a slow operation. It was added to prevent main thread freeze when user pastes a long string.

What length will be optimal for you?

@asebert-caue
Copy link
Author

Thank you for your response. I understand the need to lock things down to keep the application running smoothly, and I don't have a specific benchmark in mind for text length.

However, the maximum length for URLs is typically 2048 characters, although this can vary depending on the browser and server. Given this, it might be useful to allow for a higher limit than 450 characters to accommodate longer URLs. Is this length already too long?

Additionally, it would be helpful to specify this limit in the documentation so that users don't mistakenly attribute issues to a poor implementation of their regex.

What do you think?

@neSpecc
Copy link
Member

neSpecc commented Nov 6, 2024

I believe we shouldn’t add a new config property every time. Instead, it’s better to adjust the existing settings to cover most cases. I’d suggest increasing the limit from 450 to a bigger number that won’t freeze the browser.

A limit of 2000 seems excessive, in my opinion. It might work for technical web pages but not for embed-ready pages like YouTube, X, etc., which are the most common use cases for the paste pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants