Fix collection names with surrounding whitespace being accepted on creation - #28038
Conversation
kheiner
left a comment
There was a problem hiding this comment.
I'm just a curious person who's looking at PRs to better improve my contributions... Hopefully it's helping others including myself but I have no affiliation with Directus other than wanting to contribute.
Deletion already trims, so a collection created this way could not be deleted under the name it was created with.
I didn't see this in the code, and if the assumption is faulty, wouldn't it make phantom db_tables because functionally things wouldn't be found in the deletion process? I could be wrong here.
Also - is this a good case for a database migration just in case someone has created these tables already?
I know there's a community request feature for the ability to rename collection fields and might be worth ensuring the trim exists everywhere
|
Yeah, i was wrong. I checked deleteOne and the DELETE route: no trim anywhere in the delete path, exact string match only. Edited the PR description with the correction and the actual risk. Left a migration out of this PR since renaming an already-existing padded collection means renaming its DB table too, and that felt like it deserved its own discussion rather than riding along with a bugfix. Open to adding it here if that's preferred. |
What's Changed
createOnenow rejects collection names with paddingTested Scenarios
Review Notes / Questions / Concerns
Checklist
@directus/specs)@directus/sdk) updated to reflect the changes@directus/types) updated to reflect the changes@directus/system-data) updated for changes to system collections/fields/relationsFixes #28037