-
Notifications
You must be signed in to change notification settings - Fork 124
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
Spaces in model ids not supported. #69
Comments
Here's an example of this issue in action: irb(main):015:0> Tutorial.find("R-SKC ").id
=> "R-SKC "
irb(main):019:0> Tutorial.find("R-SKC ").to_global_id.to_s
=> "gid://tenjin/Tutorial/R-SKC "
irb(main):020:0> GlobalID.parse("gid://tenjin/Tutorial/R-SKC ")
=> nil |
I'm not sure how common this is. Does overriding |
@kaspth needing to support trailing spaces might be an edge case, but that's what encoding schemes are for. AIUI, we're currently insisting (well, assuming) that all identifiers contain only characters that are safe unescaped in a URL path segment. Are we deriving some benefit from that restriction, beyond not having to call a method? 😕 |
@kaspth I think this is less a case of 'trailing spaces are weird, why would anybody need that' and more a case of the fact that ActiveRecord supports a far wider range of values as IDs than GlobalID. It would be nice to fix that. Also, for the majority of cases, urlencoding the ID should be backwards compatible. |
@matthewd @thomasfedb Sorry for being slow here. You're both right, and Active Record supporting many more types of ids is why we should fix this. @thomasfedb would you be interested in opening a PR? 😄 |
I have an external database which has text identifiers, some of which end in a trailing space.
When using global ids with these records, the global ids generated fail to be parsed, and therefore lookup also fails.
Perhaps model ids should be urlencoded?
The text was updated successfully, but these errors were encountered: