-
Notifications
You must be signed in to change notification settings - Fork 6
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
Possible bug: Slug field invalid format #6
Comments
I think we could add the beforeValidate to this file -> https://github.com/joas8211/payload-tenancy/blob/f687c556ab5518be52a3e732590136237943ed4d/src/fields/tenantSlug.ts |
I don't know if I consider this a bug. URL can contain almost, if not, any character but it just has to be encoded in the correct way. There actually is a bug in path mapping middleware though. It should decode the slug before trying to find tenant that matches that slug. Also I'm thinking that maybe we make it more easier to modify the fields, so that users of this plugin that want to limit the way slug can be formatted, can do that by adding their own validation or auto formatting. @TatisLois, how does that sound to you? Would it be enough if I add the slug decoding and allow to modify the fields? |
@joas8211 that would be perfect, currently I was trying to modify it in a |
I noticed that a slug can be saved in a invalid format for example
my slug
, ideally this would convert tomy-slug
for the user.In other payload projects i've used this utils in a
beforeValidate
hook, what are your thoughts of including it into the project or a similar solution?Alternatively is it possible to extend your tenancy collection to pass this in myself for the field?
The text was updated successfully, but these errors were encountered: