-
-
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 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
1 task
9larsons
added a commit
that referenced
this issue
Oct 15, 2024
ref #20 I -believe- this works all right. It's at the end of the rules so it should allow for matching on just about anything else practical, then allow us a chance at matching a single character string, before throwing a Lexical Error. I've added negation for all special chars except for + and - as you ought to be able to do 'post:a+other' and 'post:a-something'.
9larsons
added a commit
that referenced
this issue
Oct 17, 2024
ref #20 I -believe- this works all right. It's at the end of the rules so it should allow for matching on just about anything else practical, then allow us a chance at matching a single character string, before throwing a Lexical Error. I've added negation for all special chars except for + and - as you ought to be able to do 'post:a+other' and 'post:a-something'.
Fixed by 07cc8c1. |
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: