Skip to content

Commit

Permalink
fixed: internal url with fragment issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mienaiyami committed May 6, 2023
1 parent c8eca9a commit 631561b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Components/EPubReader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ function parseEPubHTMLX(filePath: string, parser: DOMParser) {
if (href_old)
if (!href_old.startsWith("http")) {
// (e as HTMLLinkElement).href = (e as HTMLLinkElement).href.split("#").splice(-1)[0];
e.setAttribute("data-href", window.path.join(window.path.dirname(filePath), href_old));
e.setAttribute(
"data-href",
href_old[0] === "#"
? filePath + href_old
: window.path.join(window.path.dirname(filePath), href_old)
);
e.removeAttribute("href");
}
});
Expand Down

0 comments on commit 631561b

Please sign in to comment.