Skip to content

Commit

Permalink
Bugfix #57: Unresolved relative path for epub contents
Browse files Browse the repository at this point in the history
  • Loading branch information
wustho committed Apr 17, 2022
1 parent f9427cf commit 50dd4fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions epy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""


__version__ = "2022.3.25"
__version__ = "2022.4.18"
__license__ = "GPL-3.0"
__author__ = "Benawi Adha"
__email__ = "benawiadha@gmail.com"
Expand Down Expand Up @@ -52,6 +52,7 @@
import uuid
import xml.etree.ElementTree as ET
import zipfile
import zlib

from typing import Optional, Union, Sequence, Tuple, List, Dict, Mapping, Set, Type, Any
from dataclasses import dataclass, field
Expand Down Expand Up @@ -720,7 +721,7 @@ def initialize(self) -> None:
version = content_opf.getroot().get("version")

contents = Epub._get_contents(content_opf)
self.contents = tuple(self.root_dirpath + content for content in contents)
self.contents = tuple(urljoin(self.root_dirpath, content) for content in contents)

if version in {"1.0", "2.0"}:
# "OPF:manifest/*[@id='ncx']"
Expand Down Expand Up @@ -752,7 +753,7 @@ def get_raw_text(self, content_path: Union[str, ET.Element]) -> str:
try:
content = self.file.open(content_path).read()
break
except Exception as e:
except zlib.error as e:
tries += 1
if max_tries is not None and tries >= max_tries:
raise e
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "epy-reader"
version = "2022.3.25"
version = "2022.4.18"
description = "CLI Ebook Reader"
authors = ["Benawi Adha <benawiadha@gmail.com>"]
license = "GPL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="epy-reader",
version="2022.3.25",
version="2022.4.18",
description="Terminal/CLI Ebook (epub, fb2, mobi, azw3) Reader",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 50dd4fa

Please sign in to comment.