From e5222ccdde4a067a1356864fd9c6504f06bdb0a7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 14 Jul 2023 11:28:56 +0530 Subject: [PATCH] Windows: HTML Input: Fix error when trying to add HTML files with links to other files that are invalid pathnames. Fixes #2027763 [Convert HTML page to EPUB is no longer possible](https://bugs.launchpad.net/calibre/+bug/2027763) --- src/calibre/utils/filenames.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/utils/filenames.py b/src/calibre/utils/filenames.py index 182fab9c1e..631cf4cbc8 100644 --- a/src/calibre/utils/filenames.py +++ b/src/calibre/utils/filenames.py @@ -630,6 +630,10 @@ if iswindows: return get_long_path_name(lpath) except FileNotFoundError: return path + except OSError as e: + if e.winerror == 123: # ERR_INVALID_NAME + return path + raise else: def make_long_path_useable(path):