@dewib/xhr-cache
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -5,2 +5,9 @@ # Changelog | ||
### [3.1.2](https://github.com/gaetansenn/xhr-cache/compare/v3.1.1...v3.1.2) (2021-03-11) | ||
### Bug Fixes | ||
* fix windows device path match ([17fd17b](https://github.com/gaetansenn/xhr-cache/commit/17fd17beb46d3b3a58df7296271f9015e4498792)) | ||
### [3.1.1](https://github.com/gaetansenn/xhr-cache/compare/v3.1.0...v3.1.1) (2021-03-09) | ||
@@ -7,0 +14,0 @@ |
@@ -275,3 +275,3 @@ import { join, resolve } from 'path' | ||
const middleware = async (req, res, next) => { | ||
const matchResult = match(`/${path}`, { decode: decodeURIComponent })(req.url) | ||
const matchResult = match(`/${path.replace(/\\/g, '/')}`, { decode: decodeURIComponent })(join(req.url).replace(/\\/g, '/')) | ||
@@ -278,0 +278,0 @@ if (!matchResult) { next() } else { |
@@ -36,7 +36,9 @@ export const libPrefix = '[xhr-cache]' | ||
const resource = resources.find(resource => resource.middleware && match(resource.middleware.path, { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl))) | ||
const resource = resources.find(resource => | ||
resource.middleware && match(resource.middleware.path.replace(/\\/g, '/').replace(/\\\\/g, '/'), { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl).replace(/\\/g, '/')) | ||
) | ||
if (!resource) { throw new Error(`${libPrefix} Resource url ${resourceUrl} not found`) } | ||
const matchResult = match(resource.middleware.path, { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl)) | ||
const matchResult = match(resource.middleware.path.replace(/\\/g, '/').replace(/\\\\/g, '/'), { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl).replace(/\\/g, '/')) | ||
@@ -43,0 +45,0 @@ if (resource) { return resource.middleware.handler(matchResult.params, { get: resource.get, store: resource.store }) } |
{ | ||
"name": "@dewib/xhr-cache", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Cache api resources and serve it as static resource", |
@@ -1,2 +0,2 @@ | ||
# XHR Cache Module v3.2.1 | ||
# XHR Cache Module v3.2.2 | ||
@@ -3,0 +3,0 @@ [![npm version][npm-version-src]][npm-version-href] |
23397
407