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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Author slug with one letter causes failed filter #20133

Open
1 task done
betschki opened this issue May 5, 2024 · 1 comment
Open
1 task done

Author slug with one letter causes failed filter #20133

betschki opened this issue May 5, 2024 · 1 comment
Labels
needs:triage [triage] this needs to be triaged by the Ghost team

Comments

@betschki
Copy link
Contributor

betschki commented May 5, 2024

Issue Summary

A staff member that signs up with a single-letter first name upon invitation will not be able to use Ghost at all. They only see an error message in the Ghost admin:

Request not understood error, cannot list posts. Error parsing filter

CleanShot 2024-05-05 at 19 03 18@2x

Looking at the network requests, the request to /ghost/api/admin/posts/?formats=mobiledoc%2Clexical&limit=30&page=1&filter=status%3A%5Bdraft%2Cscheduled%2Cpublished%2Csent%5D%2Bauthors%3Aj fails.

As soon as the last filter is removed, the API request succeeds:

https://tireless-buzzard.pikapod.net/ghost/api/admin/posts/?formats=mobiledoc%2Clexical&limit=30&page=1&filter=status%3A%5Bdraft%2Cscheduled%2Cpublished%2Csent%5D

I have then tried to change the author slug in the database from "j" to "jb" – and things started to work.

This has been tested in different environments, both locally with development configurations, as well as on different managed hosts. Ghost v5.82.2 and v5.82.6 have been tested, both from the CLI as well as Docker images.

Steps to Reproduce

  1. Invite a new staff member as contributor
  2. Accept the invitation and register – IMPORTANT: Set the name to have a single-letter first name, e.g. "J Doe" instead of "John Doe"
  3. See the error

Ghost Version

v5.82.6

Node.js Version

18 LTS

How did you install Ghost?

Ghost CLI

Database type

MySQL 8

Browser & OS version

Mac OS 14.4.1, latest Chrome and latest Safari tested

Relevant log / error output

[2024-05-05 16:55:19] ERROR "GET /ghost/api/admin/posts/?formats=mobiledoc%2Clexical&limit=30&page=1&filter=status%3A%5Bdraft%2Cscheduled%2Cpublished%2Csent%5D%2Bauthors%3Aj" 400 12ms


Error parsing filter


Error ID:

415527a0-0b00-11ef-96dc-2bc1b8db7476


----------------------------------------


Error: Query Error: unrecognized text "j" in filter at char 24

at Child.applyDefaultAndCustomFilters (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/bookshelf-filter/lib/bookshelf-filter.js:66:23)

...ished,sent]+authors:j)+type:post

-----------------------^

at lexer.parseError (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/nql-lang/dist/parser.js:760:11)

at Object.next (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/nql-lang/dist/parser.js:625:25)

at Object.lex (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/nql-lang/dist/parser.js:635:22)

at lex (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/nql-lang/dist/parser.js:246:27)

at Parser.parse (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/nql-lang/dist/parser.js:259:26)

at exports.parse (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/nql-lang/lib/nql.js:18:44)

at api.parse (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/nql/lib/nql.js:15:31)

at api.querySQL (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/nql/lib/nql.js:49:44)

at Builder.<anonymous> (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/bookshelf-filter/lib/bookshelf-filter.js:63:24)

at Object.query (/var/lib/ghost/versions/5.82.2/node_modules/bookshelf/lib/helpers.js:164:14)

at Child.query (/var/lib/ghost/versions/5.82.2/node_modules/bookshelf/lib/model.js:1387:22)

at Child.applyDefaultAndCustomFilters (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/bookshelf-filter/lib/bookshelf-filter.js:56:22)

at Function.getFilteredCollection (/var/lib/ghost/versions/5.82.2/core/server/models/base/plugins/filtered-collection.js:13:32)

at Function.findPage (/var/lib/ghost/versions/5.82.2/core/server/models/base/plugins/crud.js:83:41)

at PostsService.browsePosts (/var/lib/ghost/versions/5.82.2/node_modules/@tryghost/posts-service/lib/PostsService.js:81:44)

at Object.query (/var/lib/ghost/versions/5.82.2/core/server/api/endpoints/posts.js:73:33)

Code of Conduct

  • I agree to be friendly and polite to people in this repository
@github-actions github-actions bot added the needs:triage [triage] this needs to be triaged by the Ghost team label May 5, 2024
@Tanu1201
Copy link

Hey, I am Tanu sharma having 2 year of exp in SDE field can I take this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:triage [triage] this needs to be triaged by the Ghost team
Projects
None yet
Development

No branches or pull requests

2 participants