1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

Update Id generation to use full URL instead of just the filename

This commit is contained in:
Fred Chasen 2023-05-17 13:54:48 -07:00
parent dc23a53f62
commit de1861ba86

View file

@ -161,7 +161,7 @@ class Publication {
} }
item.url = resolve(this.url, item.url || item.href); item.url = resolve(this.url, item.url || item.href);
// TEMP hack for handling EpubCFI // TEMP hack for handling EpubCFI
const id = encodeURIComponent(filename(item.url).split(".")[0]); const id = "id_" + encodeURIComponent(item.url).replaceAll("%", "--");
item.id = id; item.id = id;
// Index 2 for Sections // Index 2 for Sections
item.cfiBase = item.cfiBase || `2/${index * 2}[${id}]` item.cfiBase = item.cfiBase || `2/${index * 2}[${id}]`
@ -219,7 +219,7 @@ class Publication {
} }
item.url = this.resolve(item.url || item.href); item.url = this.resolve(item.url || item.href);
// TEMP hack for handling EpubCFI // TEMP hack for handling EpubCFI
const id = encodeURIComponent(filename(item.url).split(".")[0]); const id = "id_" + encodeURIComponent(item.url).replaceAll("%", "--");
item.id = id; item.id = id;
// Index 4 for Resources // Index 4 for Resources
item.cfiBase = item.cfiBase || `4/${index * 2}[${id}]` item.cfiBase = item.cfiBase || `4/${index * 2}[${id}]`