Commit 8f795335 authored by Yannis Barlas's avatar Yannis Barlas

Merge branch 'styles-root-fix' into 'master'

Correction

See merge request !2
parents 34ff14a1 e4ee3e19
......@@ -146,6 +146,7 @@ class HTMLEPUB {
const epub = this
const resourceRoot = epub.options.resourceRoot.replace(/\/?$/, '/') // ensure trailing slash
const stylesRoot = epub.options.stylesRoot.replace(/\/?$/, '/') // ensure trailing slash
$('img[src]').each((index, node) => {
const $node = $(node)
......@@ -172,10 +173,10 @@ class HTMLEPUB {
const id = `style-${chapter}-${index}`
const uri = $node.attr('href').replace(/^\//, '') // ensure no leading slash
const source = url.resolve(resourceRoot, uri)
if (source.indexOf(resourceRoot) !== 0) {
throw new Error('Resource is outside the resource root')
const source = url.resolve(stylesRoot, uri)
if (source.indexOf(stylesRoot) !== 0) {
throw new Error('Resource is outside the style root')
}
const target = `styles/${id}.css`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment