From 9d23988b4d9ae9b54072598a0449ecf72392dd07 Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 9 Oct 2020 16:27:24 +0300 Subject: [PATCH] fix: incorrect resolve path in window, close #17 --- lib/imgAutosize.js | 3 ++- package-lock.json | 3 +-- package.json | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/imgAutosize.js b/lib/imgAutosize.js index 0d6ac52..3a912a4 100644 --- a/lib/imgAutosize.js +++ b/lib/imgAutosize.js @@ -2,6 +2,7 @@ const url = require('url'); const path = require('path'); const http = require('http'); const https = require('https'); +const normalizePath = require('normalize-path'); const imageSize = require('image-size'); const ratio = require('./ratio.js'); @@ -94,7 +95,7 @@ function translatePath(projectRoot, htmlRelativePath, imgPath, isQuestionMarkAsV return imgAbsolutePath.replace(/\?[^/]*/, ''); } - return imgAbsolutePath; + return normalizePath(imgAbsolutePath); } function getImageDimensions(imgPath) { diff --git a/package-lock.json b/package-lock.json index a684818..82ffa2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1847,8 +1847,7 @@ "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, "nyc": { "version": "15.1.0", diff --git a/package.json b/package.json index 6688172..2af3c54 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ ], "dependencies": { "image-size": "^0.8.3", + "normalize-path": "^3.0.0", "nyc": "^15.1.0" }, "devDependencies": {