Ghost/apps/sodo-search
Mark Stosberg 7fa083d774
🐛 Fixed escaping search terms that contain special characters (#18151)
fixes https://github.com/TryGhost/Ghost/issues/18133

Before, Sodo Search was not escaping search input before using the search terms in a regular expression, so using special characters could result in an invalid regular expression which would crash JavaScript.

As regular expressions date back to Perl, so does a standard solution for this, which called quotemeta in Perl. It doesn't exist 1:1 in JavaScript, but StackOverflow had the answer: stackoverflow.com/questions/6318710/javascript-equivalent-of-perls-q-e-or-quotemeta

So a line of code is added to escape the special characters in the regex for passing them through. This is the same code that the quotemeta module on NPM would use.
2023-09-20 10:17:21 +02:00
..
src 🐛 Fixed escaping search terms that contain special characters (#18151) 2023-09-20 10:17:21 +02:00
.yarnrc Prevented git tags from being created for apps 2023-07-10 13:09:28 +02:00
LICENSE 2023 (2) 2023-08-03 21:04:20 +01:00
package.json Update dependency vite-plugin-svgr to v3.3.0 2023-09-20 08:41:57 +02:00
README.md 2023 (2) 2023-08-03 21:04:20 +01:00
tailwind.config.js Moved Sodo-Search into apps/ 2023-06-14 12:10:57 +02:00
vite.config.js Converted CRA packages to Vite 2023-07-27 09:43:35 +02:00

Sodo Search

Development

Pre-requisites

  • Run yarn in Ghost monorepo root
  • Run yarn in this directory

Running via Ghost yarn dev in root folder

You can automatically start the Sodo-Search dev server when developing Ghost by running Ghost (in root folder) via yarn dev --search.

Copyright & License

Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license.