Ghost Admin - Error filtering for posts with author slug of length 1

Hi, I don’t think this is something that’s that high priority as it’s probably an edge case but it seems that using an author slug of length 1 breaks the Ghost Admin filter by author functionality (and by extension anything that uses the same API endpoint). If I change the author slug a slug of length 2 or higher, I’m able to filter by that author’s slug again.

Here’s an entry from the error log;

{
  "name":"Log",
  "hostname":"planamag",
  "pid":19192,
  "level":50,
  "req":{
    "meta":{
      "requestId":"b05edaa6-c174-449f-9e0c-9dce58f4d5a2",
      "userId":"5b84e0c67e388e3cf5be748b"
    },
    "url":"/posts/?limit=30&page=1&filter=status%3A%5Bdraft%2Cscheduled%2Cpublished%5D%2Bauthors%3Aq",
    "method":"GET",
    "originalUrl":"/ghost/api/v3/admin/posts/?limit=30&page=1&filter=status%3A%5Bdraft%2Cscheduled%2Cpublished%5D%2Bauthors%3Aq",
    "params":{},
    "headers":{
      "x-forwarded-proto":"https",
      "x-real-ip":"44.224.2.133",
      "host":"planamag.com",
      "x-nginx-proxy":"true",
      "connection":"close",
      "accept":"application/json, text/javascript, */*; q=0.01",
      "dnt":"1",
      "x-requested-with":"XMLHttpRequest",
      "x-ghost-version":"3.26",
      "app-pragma":"no-cache",
      "user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
      "content-type":"application/json; charset=UTF-8",
      "sec-fetch-site":"same-origin",
      "sec-fetch-mode":"cors",
      "sec-fetch-dest":"empty",
      "referer":"https://planamag.com/ghost/",
      "accept-encoding":"gzip, deflate, br",
      "accept-language":"en-US,en;q=0.9",
      "cookie":"**REDACTED**"
    },
    "query":{
      "limit":"30",
      "page":"1",
      "filter":"status:[draft,scheduled,published]+authors:q"}},
      "res":{
        "_headers":{
          "x-powered-by":"Express",
          "cache-control":"no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
          "content-type":"application/json; charset=utf-8",
          "content-length":"232",
          "etag":"W/\"e8-rdwJ52UL4TPbqmP33hk0hlsoxuA\"",
          "vary":"Accept-Encoding"
        },
        "statusCode":400,
        "responseTime":"25ms"
      },
      "err":{
        "id":"608ad8b0-cd63-11ea-82f0-47fd86c6e32c",
        "domain":"https://planamag.com",
        "code":null,
        "name":"BadRequestError",
        "statusCode":400,
        "level":"normal",
        "message":"Error parsing filter",
        "stack":"BadRequestError: Error parsing filter
          at new BadRequestError (/var/www/ghost/versions/3.26.1/node_modules/ghost-ignition/lib/errors/index.js:113:23)
          at Child.applyDefaultAndCustomFilters (/var/www/ghost/versions/3.26.1/core/server/models/plugins/filter.js:104:23)
          at Function.findPage (/var/www/ghost/versions/3.26.1/core/server/models/base/index.js:896:24)
          at Object.query (/var/www/ghost/versions/3.26.1/core/server/api/canary/posts.js:40:32)
          at Object.query (/var/www/ghost/versions/3.26.1/core/server/api/shared/pipeline.js:156:24)
          at Promise.resolve.then.then.then.then (/var/www/ghost/versions/3.26.1/core/server/api/shared/pipeline.js:243:35)
          at tryCatcher (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/util.js:16:23)
          at Promise._settlePromiseFromHandler (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/promise.js:547:31)
          at Promise._settlePromise (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/promise.js:604:18)
          at Promise._settlePromise0 (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/promise.js:649:10)
          at Promise._settlePromises (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/promise.js:729:18)
          at _drainQueueStep (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/async.js:93:12)
          at _drainQueue (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/async.js:86:9)
          at Async._drainQueues (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/async.js:102:5)
          at Immediate.Async.drainQueues [as _onImmediate] (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/async.js:15:14)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
          at processImmediate (timers.js:658:5)
          at process.topLevelDomainCallback (domain.js:126:23)\n\nError: Query Error: unrecognized text \"q\" in filter at char 24\n...,published]+authors:q)+type:post\n-----------------------^
          at Object.lexer.parseError (/var/www/ghost/versions/3.26.1/node_modules/@nexes/nql-lang/dist/parser.js:711:11)
          at Object.next (/var/www/ghost/versions/3.26.1/node_modules/@nexes/nql-lang/dist/parser.js:594:25)
          at Object.lex (/var/www/ghost/versions/3.26.1/node_modules/@nexes/nql-lang/dist/parser.js:604:22)
          at lex (/var/www/ghost/versions/3.26.1/node_modules/@nexes/nql-lang/dist/parser.js:215:27)
          at Parser.parse (/var/www/ghost/versions/3.26.1/node_modules/@nexes/nql-lang/dist/parser.js:228:26)
          at Object.exports.parse (/var/www/ghost/versions/3.26.1/node_modules/@nexes/nql-lang/lib/nql.js:18:44)
          at Object.api.parse (/var/www/ghost/versions/3.26.1/node_modules/@nexes/nql/lib/nql.js:15:31)
          at Object.api.querySQL.qb [as querySQL] (/var/www/ghost/versions/3.26.1/node_modules/@nexes/nql/lib/nql.js:49:44)
          at Builder.query (/var/www/ghost/versions/3.26.1/core/server/models/plugins/filter.js:101:24)
          at Object.query (/var/www/ghost/versions/3.26.1/node_modules/bookshelf/lib/helpers.js:57:14)
          at Child.query (/var/www/ghost/versions/3.26.1/node_modules/bookshelf/lib/model.js:1256:22)
          at Child.applyDefaultAndCustomFilters (/var/www/ghost/versions/3.26.1/core/server/models/plugins/filter.js:94:22)
          at Function.findPage (/var/www/ghost/versions/3.26.1/core/server/models/base/index.js:896:24)
          at Object.query (/var/www/ghost/versions/3.26.1/core/server/api/canary/posts.js:40:32)
          at Object.query (/var/www/ghost/versions/3.26.1/core/server/api/shared/pipeline.js:156:24)
          at Promise.resolve.then.then.then.then (/var/www/ghost/versions/3.26.1/core/server/api/shared/pipeline.js:243:35)
          at tryCatcher (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/util.js:16:23)
          at Promise._settlePromiseFromHandler (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/promise.js:547:31)
          at Promise._settlePromise (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/promise.js:604:18)
          at Promise._settlePromise0 (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/promise.js:649:10)
          at Promise._settlePromises (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/promise.js:729:18)
          at _drainQueueStep (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/async.js:93:12)
          at _drainQueue (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/async.js:86:9)
          at Async._drainQueues (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/async.js:102:5)
          at Immediate.Async.drainQueues [as _onImmediate] (/var/www/ghost/versions/3.26.1/node_modules/bluebird/js/release/async.js:15:14)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
          at processImmediate (timers.js:658:5)
          at process.topLevelDomainCallback (domain.js:126:23)"
      },
      "msg":"Error parsing filter",
      "time":"2020-07-24T04:08:49.347Z",
      "v":0
    }

I think the easiest fix is to change the slug to something longer but I thought I’d report this bug anyway.