0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/ghost/mw-version-match
Daniel Lockyer 4b51942403 🐛 Fixed triggering wrong error for invalid client versions
fix https://linear.app/ghost/issue/ENG-1502/handle-malformed-client-versions-to-avoid-versionmismatcherror

- in the event we pass a client version that is invalid (ie, anything
  that doesn't resemble semver version), we currently throw a
  VersionMismatchError
- this is slightly misleading because although it is a version mismatch,
  it moreso that it's an invalid string to pass in this header
- to fix that, we can just use `validRange` from `semver` to detect
  this, and throw a BadRequestError with a meaningful error message
- this helps us detect whether the header is actually a version
  mismatch, or an invalid input
2024-11-27 11:52:45 +01:00
..
lib 🐛 Fixed triggering wrong error for invalid client versions 2024-11-27 11:52:45 +01:00
test 🐛 Fixed triggering wrong error for invalid client versions 2024-11-27 11:52:45 +01:00
.eslintrc.js
index.js
package.json Update TryGhost packages 2024-08-05 12:12:34 +02:00
README.md

Mw Version Match

Version compatibility middleware for Ghost

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