Ghost/ghost/link-tracking
Simon Backx e5f644c27f
🐛 Fixed contain/starts/endsWith filters with /, _ or % in them (#19015)
fixes GRO-25

Updated @tryghost/nql to 0.12.0 and other packages that depend on it

1. SQLite: when a filter string contains /.

When we use a NQL contain/starts/endsWith filter that contains a slash,
underlyingly the whole filter will get converted to a MongoDB query, in
which we just use a regexp to represent the filter. In here we will
escape the slash: \/ as expected in a regexp. Later when we convert this
MongoDB query back to knex/SQL, we use a SQL LIKE query. Currently we
don't remove the escaping here for a normal slash. MySQL seems to ignore
this (kinda incorrect). SQLite doesn't like it, and this breaks queries
on SQLite that use slashes. The solution here is simple: remove the
backslash escaping when converting the regexp to LIKE, just like we do
with other special regexp characters.

2. We don't escape % and _, which have a special meaning in LIKE queries

Usage of % and _ is now as expected and doesn't have the special SQL
meaning anymore.
2023-11-16 09:35:20 +00:00
..
lib Added quotes to NQL filters with ids (#18958) 2023-11-13 12:00:20 +01:00
test Updated to use assert/strict everywhere (#17047) 2023-06-21 09:56:59 +01:00
.eslintrc.js Added initial link-tracking package 2022-09-14 13:24:17 -04:00
index.js Added initial link-tracking package 2022-09-14 13:24:17 -04:00
package.json 🐛 Fixed contain/starts/endsWith filters with /, _ or % in them (#19015) 2023-11-16 09:35:20 +00:00
README.md Added initial link-tracking package 2022-09-14 13:24:17 -04:00

Link Tracking

Usage

Develop

This is a monorepo package.

Follow the instructions for the top-level repo.

  1. git clone this repo & cd into it as usual
  2. Run yarn to install top-level dependencies.

Test

  • yarn lint run just eslint
  • yarn test run lint and tests