-
Notifications
You must be signed in to change notification settings - Fork 382
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
feat: allow non-latin characters in old-path redirects #3283
Conversation
Why only redirects? I think all page paths can support non-latin characters |
packages/sdk/src/schema/pages.ts
Outdated
.string() | ||
.refine( | ||
(path) => | ||
new RegExp(/^(?:\/[-_a-zA-Z0-9*:?\\\p{L}\\p{N}\\p{M}\\\/]+)+$/gmu).test( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there an original implementation of this? I think its a non-trivial thing to write and we should be able to use something battle-tested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just extended \\p{L}\\p{N}\\p{M}\\
to the original one to allow non-latin characters though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw is not possible to use any of the standard api for this? e.g. URL api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is the original coming from? is it worth linking to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will see, ideally should work though. Will check about the +/-
's of both approaches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is the original coming from? is it worth linking to?
Original regex is from PagesPath
, just extending with latin characters. Until there is a decision to support non-latin across all the paths inside webstudio projects. Maybe checking only for old paths (projects that are designed in another platforms) would be safe way to go.
Yup, thought of it. But didn't want to change without cross checking with the team once. |
I just checked webflow and when I put japanese "日本語" in there it gets transformed to "ri-ben-yu", do you know why? i am very surrprised and need to know why :) |
They might be using translations, and i really wonder why they are being converted to simple english though. Is non-latin in urls is not a standard practice 🤔 |
Lets see if twitter knows why Webflow converts this way |
|
As an idea, check what wordpress is doing, I think they had 20 years to figure this out |
there is nothing bad with prepending for new URL, we do this all the time. You can even pass fake origin as second argument. |
Closing this PR, as the support for non-latin characters is a little bit bigger topic than just enabling in regex. Follow #3225 for further updates. |
Description
fixes #3225
Steps for reproduction
Code Review
Before requesting a review
Before merging
.env.example
and thebuilder/env-check.js
if mandatory