-
-
Notifications
You must be signed in to change notification settings - Fork 369
Application URLs with international characters are considered invalid #1539
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
Comments
Looks like this section is the cause: jellyseerr/src/components/Settings/SettingsMain/index.tsx Lines 73 to 77 in 29034b3
As far as I can tell, the RegEx doesn't include these kinds of characters. I'd submit a PR for it, if RegEx wasn't greek to me. |
We should even use something else instead of these regexs. |
Relevant changes occured in: Feature added: 026795d Initially I wondered why this didnt just use the built in url validation from yup, but given the commit message in 14f316a it seems that this is less strict than that. Since we have some duplication for this validation as seen in 14f316a, I suggest we create a module for validating url ( applicationUrl: Yup.string()
.test(
'is-url',
intl.formatMessage(messages.validationApplicationUrl),
(value) => {
if (!value) return true; // Allow empty value
return isValidURL(toPunyCode(value))
}
)
.test(
'no-trailing-slash',
intl.formatMessage(messages.validationApplicationUrlTrailingSlash),
(value) => !value || !value.endsWith('/')
), |
Yes, I'm in favor of using the URL constructor. It could be as simple as: function isValidURL(text: string) {
try {
const url = new URL(text);
return url.protocol === 'http:' || url.protocol === 'https:';
catch {
return false;
}
}
I don't understand what you mean with that. |
AFAIK it shouldn't be the case. We use axios everywhere in the app, and axios should support it, so i don't really see the point in managing encoding/decoding manually. |
…avaScript URL constructor Replaced regex-based URL validation with the native JavaScript URL constructor to improve reliability. This approach should be more robust and should help prevent bugs like the one we previously encountered with malformed regex. fix #1539
Description
Trying to set an application URL with international chararacters (ex: Æ Ø Å) doesn't pass validation.
Version
2.5.1
Steps to Reproduce
Screenshots
Logs
Platform
desktop
Database
SQLite (default)
Device
Window Desktop
Operating System
Windows 10
Browser
Firefox 136.0.2
Additional Context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: