diff --git a/src/calibre/db/notes/exim.py b/src/calibre/db/notes/exim.py index a180b21462..0ff93ac8ca 100644 --- a/src/calibre/db/notes/exim.py +++ b/src/calibre/db/notes/exim.py @@ -5,7 +5,7 @@ import os import shutil from html5_parser import parse from lxml import html -from urllib.parse import urlparse +from urllib.parse import unquote, urlparse from calibre.ebooks.chardet import xml_to_unicode from calibre.utils.cleantext import clean_xml_chars @@ -63,7 +63,7 @@ def import_note(path_to_html_file: str, add_resource) -> dict: except Exception: continue if purl.scheme in ('', 'file'): - path = purl.path + path = unquote(purl.path) if not os.path.isabs(path): path = os.path.join(basedir, path) q = os.path.normcase(get_long_path_name(os.path.abspath(path))) diff --git a/src/calibre/db/tests/notes.py b/src/calibre/db/tests/notes.py index ee4df65f44..49805fc241 100644 --- a/src/calibre/db/tests/notes.py +++ b/src/calibre/db/tests/notes.py @@ -124,14 +124,14 @@ def test_cache_api(self: 'NotesTest'): self.assertIsNone(cache.get_notes_resource(h1)) self.assertIsNone(cache.get_notes_resource(h2)) # test exim of note - doc = '

test simple exim of note with resources . Works or not

' + doc = '

test simple exim of note with resources . Works or not

' with tempfile.TemporaryDirectory() as tdir: idir = os.path.join(tdir, 'i') os.mkdir(idir) with open(os.path.join(idir, 'index.html'), 'w') as f: f.write(doc) - shutil.copyfile(get_image_path('lt.png'), os.path.join(idir, 'r1.png')) - shutil.copyfile(get_image_path('library.png'), os.path.join(idir, 'r2.png')) + shutil.copyfile(get_image_path('lt.png'), os.path.join(idir, 'r 1.png')) + shutil.copyfile(get_image_path('library.png'), os.path.join(idir, 'r 2.png')) note_id = cache.import_note('authors', author_id, f.name) self.assertGreater(note_id, 0) self.assertIn('

test simple exim