@dewib/xhr-cache
Advanced tools
Comparing version 3.2.4 to 3.2.6
@@ -5,2 +5,11 @@ # Changelog | ||
### [3.2.6](https://github.com/gaetansenn/xhr-cache/compare/v3.2.4...v3.2.6) (2021-07-12) | ||
### [3.2.4](https://github.com/gaetansenn/xhr-cache/compare/v3.2.3...v3.2.4) (2021-07-12) | ||
### Bug Fixes | ||
* fix regex path middleware ([16eb1c0](https://github.com/gaetansenn/xhr-cache/commit/16eb1c0550242194a44efec93f16970d7283812a)) | ||
### [3.2.3](https://github.com/gaetansenn/xhr-cache/compare/v3.2.2...v3.2.3) (2021-05-06) | ||
@@ -7,0 +16,0 @@ |
@@ -274,3 +274,4 @@ import { join, resolve } from 'path' | ||
const middleware = async (req, res, next) => { | ||
const matchResult = match(`/${path.replace(/\\/g, '/')}`, { decode: decodeURIComponent })(join(req.url).replace(/\\/g, '/')) | ||
// eslint-disable-next-line no-useless-escape | ||
const matchResult = match(`/${path.replace(/\\(?![^\(]*\))/g, '/')}`, { decode: decodeURIComponent })(join(req.url).replace(/\\(?![^\(]*\))/g, '/')) | ||
@@ -277,0 +278,0 @@ if (!matchResult) { next() } else { |
@@ -36,4 +36,6 @@ export const libPrefix = '[xhr-cache]' | ||
// eslint-disable-next-line no-useless-escape | ||
const regex = /\\(?![^\(]*\))/g | ||
const resource = resources.find(resource => | ||
resource.middleware && match(resource.middleware.path.replace(/\\/g, '/').replace(/\\\\/g, '/'), { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl).replace(/\\/g, '/')) | ||
resource.middleware && match(resource.middleware.path.replace(regex, '/'), { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl).replace(regex, '/')) | ||
) | ||
@@ -43,3 +45,3 @@ | ||
const matchResult = match(resource.middleware.path.replace(/\\/g, '/').replace(/\\\\/g, '/'), { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl).replace(/\\/g, '/')) | ||
const matchResult = match(resource.middleware.path.replace(regex, '/'), { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl).replace(regex, '/')) | ||
@@ -46,0 +48,0 @@ if (resource) { return Promise.resolve(resource.middleware.handler(matchResult.params, { get: resource.get, store: resource.store })) } |
{ | ||
"name": "@dewib/xhr-cache", | ||
"version": "3.2.4", | ||
"version": "3.2.6", | ||
"license": "MIT", | ||
@@ -50,23 +50,23 @@ "description": "Cache api resources and serve it as static resource", | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "7.12.17", | ||
"@commitlint/cli": "^12.1.1", | ||
"@commitlint/config-conventional": "^12.1.1", | ||
"@nuxtjs/eslint-config": "^6.0.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"@commitlint/cli": "latest", | ||
"@commitlint/config-conventional": "latest", | ||
"@nuxtjs/eslint-config": "latest", | ||
"@nuxtjs/module-test-utils": "^1.6.1", | ||
"babel-eslint": "latest", | ||
"babel-jest": "^25.4.0", | ||
"codecov": "^3.8.2", | ||
"eslint": "^7.25.0", | ||
"codecov": "latest", | ||
"eslint": "latest", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-jest": "latest", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-standard": "^5.0.0", | ||
"eslint-plugin-vue": "^7.9.0", | ||
"eslint-plugin-promise": "latest", | ||
"eslint-plugin-standard": "latest", | ||
"eslint-plugin-vue": "latest", | ||
"husky": "^4.2.5", | ||
"jest": "^25.4.0", | ||
"nuxt-edge": "^2.13.0-26465775.85383688", | ||
"standard-version": "^9.3.0" | ||
"standard-version": "latest" | ||
} | ||
} |
25082
414