mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-20 01:25:16 +00:00
Handle correctly path starting with "/"
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ var isRelative = function(href) {
|
||||
try {
|
||||
var parsed = url.parse(href);
|
||||
|
||||
return !parsed.protocol && parsed.path && parsed.path[0] != '/';
|
||||
return !!(!parsed.protocol && parsed.path);// && parsed.path[0] != '/';
|
||||
} catch(err) {}
|
||||
|
||||
return true;
|
||||
|
||||
+3
-1
@@ -154,7 +154,7 @@ function normalizeHtml(src, options) {
|
||||
function convertImages(images, options) {
|
||||
return _.reduce(images, function(prev, image) {
|
||||
return prev.then(function() {
|
||||
var imgin = links. isExternal(image.source)? image.source : path.resolve(options.book.root, image.source);
|
||||
var imgin = links. isExternal(image.source)? image.source : path.resolve(options.book.options.output, image.source);
|
||||
var imgout = path.resolve(options.book.options.output, image.dest);
|
||||
|
||||
options.book.log.debug("convert image", image.source, "to", image.dest, "...");
|
||||
@@ -210,6 +210,8 @@ function normalizePage(sections, options) {
|
||||
|
||||
return Q()
|
||||
.then(function() {
|
||||
toConvert = _.uniq(toConvert, 'source');
|
||||
|
||||
return convertImages(toConvert, options);
|
||||
})
|
||||
.thenResolve(sections);
|
||||
|
||||
Reference in New Issue
Block a user