Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

API endpoint filter slug with one character throwing error #8433

Closed
emilgoldsmith opened this issue May 2, 2017 · 3 comments
Closed

API endpoint filter slug with one character throwing error #8433

emilgoldsmith opened this issue May 2, 2017 · 3 comments
Labels
affects:api Affects the Ghost API bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with server / core Issues relating to the server or core of Ghost

Comments

@emilgoldsmith
Copy link

Welcome to Ghost's GitHub repo! 馃憢馃帀

Do you need help or have a question? Please come chat in Slack: https://ghost.org/slack 馃懌. Got an idea for a new feature? Please add it to our wishlist: http://ideas.ghost.org 馃専. Found a bug? Please fill out the sections below... thank you 馃憤

Issue Summary

When accessing the API endpoint for getting posts with a filter query of a slug with just one character it throws the following error:

ERROR: Query Error: unrecognized text "v" in filter at char 6
slug:v

I know you wouldn't generally want to use a 1 character slug and it's really stupid etc. but the editors of the blog I develop for apparently screwed up a couple of years ago I just realized. Even though 1 character slugs are stupid, I'm assuming this is not intended behaviour, yeah?

Steps to Reproduce

You can for example use these query params for your call: filter=slug:a&fields=slug,html,image,meta_description,title&limit=1

Technical details:

  • Ghost Version: 0.11.7
  • Node Version: 4.2
  • Browser/OS: Browser N/A (fetched serverside through Node.js request) on Ubuntu 16.04
  • Database: MySQL (MariaDB)
@emilgoldsmith
Copy link
Author

Also, btw I've hotfixed it by adding quotes ' around the slugs as that's what I did to fix a previous issue I submitted here which was a slug starting in a number until it was fixed. But just thought I should still report it as I don't believe it is intended behaviour.

@kirrg001 kirrg001 self-assigned this May 2, 2017
@kirrg001
Copy link
Contributor

kirrg001 commented May 2, 2017

Hey @emilgoldsmith 馃憢

Thanks for your bug report. Sounds like a bug in our GQL parser.
If somebody wants to pick this bug up, we would be thankful 馃檭

@kirrg001 kirrg001 added bug [triage] something behaving unexpectedly affects:api Affects the Ghost API help wanted [triage] Ideal issues for contributors to help with labels May 2, 2017
@kirrg001 kirrg001 removed their assignment May 2, 2017
@kirrg001 kirrg001 added LTS server / core Issues relating to the server or core of Ghost labels May 12, 2017
@ErisDS
Copy link
Member

ErisDS commented Jul 31, 2017

I've raised TryGhost/GQL#24 to track this issue. Short term, using quotes is not really a hotfix as it were. GQL supports the concept of literals - these are strings that don't require quotes. They're a special case built for simplicity, and they do have limitations.

Using a string, which is more reliable, is a perfectly sensible workaround.

Nonetheless, this limitation is a surprise to me, it's not documented nor covered by tests. Therefore it warrants and issue and investigation to see if we can fix it without breaking everything else ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:api Affects the Ghost API bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with server / core Issues relating to the server or core of Ghost
Projects
None yet
Development

No branches or pull requests

3 participants