mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
Don't replace url in stylesheets when url is data uri.
Remove query part from the url path, when try to find the file in the archive during replacing urls in the stylesheets.
This commit is contained in:
parent
4188d2f75b
commit
b465485e10
1 changed files with 2 additions and 2 deletions
|
@ -130,7 +130,7 @@ EPUBJS.replace.stylesheets = function(_store, full) {
|
|||
EPUBJS.replace.cssUrls = function(_store, base, text){
|
||||
var deferred = new RSVP.defer(),
|
||||
promises = [],
|
||||
matches = text.match(/url\(\'?\"?([^\'|^\"^\)]*)\'?\"?\)/g);
|
||||
matches = text.match(/url\(\'?\"?((?!data:)[^\'|^\"^\)]*)\'?\"?\)/g);
|
||||
|
||||
if(!_store) return;
|
||||
|
||||
|
@ -140,7 +140,7 @@ EPUBJS.replace.cssUrls = function(_store, base, text){
|
|||
}
|
||||
|
||||
matches.forEach(function(str){
|
||||
var full = EPUBJS.core.resolveUrl(base, str.replace(/url\(|[|\)|\'|\"]/g, ''));
|
||||
var full = EPUBJS.core.resolveUrl(base, str.replace(/url\(|[|\)|\'|\"]|\?.*$/g, ''));
|
||||
var replaced = _store.getUrl(full).then(function(url){
|
||||
text = text.replace(str, 'url("'+url+'")');
|
||||
}, function(reason) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue