Skip to content

Commit

Permalink
fix: resolve path for absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Oct 9, 2020
1 parent 9d23988 commit b82170e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/imgAutosize.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ function translatePath(projectRoot, htmlRelativePath, imgPath, isQuestionMarkAsV
}

const imgProjectPath = path.resolve('/' + htmlRelativePath, imgPath);
const imgAbsolutePath = path.join(projectRoot, imgProjectPath);
let imgAbsolutePath = path.join(projectRoot, imgProjectPath);

if (isQuestionMarkAsVersion) {
// Translat dir/file.jpg?v=.. → dir/file.jpg
return imgAbsolutePath.replace(/\?[^/]*/, '');
imgAbsolutePath = imgAbsolutePath.replace(/\?[^/]*/, '');
}

return normalizePath(imgAbsolutePath);
Expand Down

0 comments on commit b82170e

Please sign in to comment.