aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenadha <benawiadha@gmail.com>2022-04-18 06:23:41 +0700
committerbenadha <benawiadha@gmail.com>2022-04-18 06:23:41 +0700
commit50dd4faf4ca095b8f10a1883ca1168a2628e877e (patch)
tree56af604e4a79540f175439fe486d55f8c8a766bb
parentf9427cf70603bf1aa92a28e75a3c6be977d59ee9 (diff)
downloadepy-50dd4faf4ca095b8f10a1883ca1168a2628e877e.tar.gz
Bugfix #57: Unresolved relative path for epub contentsv2022.4.18
-rwxr-xr-xepy.py7
-rw-r--r--pyproject.toml2
-rw-r--r--setup.py2
3 files changed, 6 insertions, 5 deletions
diff --git a/epy.py b/epy.py
index 4526a12..d73389d 100755
--- a/epy.py
+++ b/epy.py
@@ -23,7 +23,7 @@ examples:
"""
-__version__ = "2022.3.25"
+__version__ = "2022.4.18"
__license__ = "GPL-3.0"
__author__ = "Benawi Adha"
__email__ = "benawiadha@gmail.com"
@@ -52,6 +52,7 @@ import textwrap
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
@@ -720,7 +721,7 @@ class Epub(Ebook):
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']"
@@ -752,7 +753,7 @@ class Epub(Ebook):
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
diff --git a/pyproject.toml b/pyproject.toml
index 191a3dc..37971a0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -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"
diff --git a/setup.py b/setup.py
index 6dd71a3..7690f90 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
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",