From 61ab2cfce3244cd4888eb090a6b9152cb783c5da Mon Sep 17 00:00:00 2001 From: j Date: Thu, 19 Nov 2015 17:36:21 +0100 Subject: [PATCH 1/2] fix relative urls --- src/book.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/book.js b/src/book.js index 58c960d..741bad1 100644 --- a/src/book.js +++ b/src/book.js @@ -999,8 +999,11 @@ EPUBJS.Book.prototype.gotoHref = function(url, defer){ split = url.split("#"); chapter = split[0]; section = split[1] || false; - // absoluteURL = (chapter.search("://") === -1) ? (this.settings.contentsPath + chapter) : chapter; - relativeURL = chapter.replace(this.settings.contentsPath, ''); + if (chapter.search("://") == -1) { + relativeURL = chapter.replace(EPUBJS.core.uri(this.settings.contentsPath).path, ''); + } else { + relativeURL = chapter.replace(this.settings.contentsPath, ''); + } spinePos = this.spineIndexByURL[relativeURL]; //-- If link fragment only stay on current chapter From 0012df1fcde1be0bc19f7dd567ec83da117851dd Mon Sep 17 00:00:00 2001 From: j Date: Thu, 19 Nov 2015 18:18:37 +0100 Subject: [PATCH 2/2] normalize htm to html --- src/core.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core.js b/src/core.js index f2b03dd..a1e6433 100644 --- a/src/core.js +++ b/src/core.js @@ -93,6 +93,9 @@ EPUBJS.core.request = function(url, type, withCredentials) { if(!type) { uri = EPUBJS.core.uri(url); type = uri.extension; + type = { + 'htm': 'html' + }[type] || type; } if(type == 'blob'){