-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Single character literals do not work #20
Labels
bug
Something isn't working
Comments
ErisDS
referenced
this issue
in TryGhost/NQL-Lang
Jul 17, 2018
closes #2 - There should be no restriction on the length of a literal - This is a horrible bug that has always existed in the language - Fixed by changing the format of the literal token to expect 1 valid start char followed by 0 or more chars NOTE: - This also had an impact on colon processing - As a result of this fix, it is now invalid to have a colon at the start of a literal - We can revisit this if it turns out to be a problem
This was referenced Dec 7, 2018
mike182uk
added a commit
to mike182uk/Ghost
that referenced
this issue
May 18, 2023
refs TryGhost/Product#3224 When a product has a slug that is a single letter, checking if a user had access to view a post associated with that product would cause a 500 error. The underlying cause of this issue is TryGhost/NQL#20 This fix circumvents this issue by providing a value that the nql lexer will not error out on
mike182uk
added a commit
to TryGhost/Ghost
that referenced
this issue
May 18, 2023
refs TryGhost/Product#3224 When a product has a slug that is a single letter, checking if a user had access to view a post associated with that product would cause a 500 error. The underlying cause of this issue is TryGhost/NQL#20 This fix circumvents this issue by providing a value that the nql lexer will not error out on
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally reported at TryGhost/GQL#24 & TryGhost/Ghost#8433
To reproduce:
a
. Publish the post.ab
. Publish the post.http://localhost:2368/ghost/api/v0.1/posts?client_id=ghost-frontend&client_secret=[client-secret]&filter=slug:ab
- see that it workshttp://localhost:2368/ghost/api/v0.1/posts?client_id=ghost-frontend&client_secret=[client-secret]&filter=slug:a
- see that it doesn't workI believe this is due to the plus sign here: https://github.com/TryGhost/GQL/blob/master/src/gql.l#L22
The badcharsincnot regex matches a single character, and then the second group matches a second character. Therefore there must be at least 2 chars for a match.
Fixing this may have other implications, if so, we should close this issue and instead, add a rule that literals must be at least 2 characters to the documentation, provide tests to demo this limitation + if possible, improve the error message.
The text was updated successfully, but these errors were encountered: