Skip to content

Commit

Permalink
FIX: win32 file:/ prefix for lxml doc URL
Browse files Browse the repository at this point in the history
  • Loading branch information
klauer committed Jul 31, 2023
1 parent 4b096b6 commit 024550e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion blark/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ def filename_from_xml(xml: Optional[lxml.etree.Element]) -> Optional[pathlib.Pat

if root.docinfo.URL is None:
return None
return pathlib.Path(root.docinfo.URL)
url = str(root.docinfo.URL)
if url.startswith("file:/"):
# Note: this only seems to be necessary on Windows and I'm not entirely sure why
url = url[len("file:/"):]
return pathlib.Path(url)


def get_child_text(
Expand Down
3 changes: 2 additions & 1 deletion blark/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dataclasses
import enum
import hashlib
import os
import pathlib
import re
from typing import Any, Dict, Generator, List, Optional, Set, Tuple, TypeVar
Expand Down Expand Up @@ -522,7 +523,7 @@ def fix_case_insensitive_path(path: AnyPath) -> pathlib.Path:
part = all_files[part.lower()]
except KeyError:
raise FileNotFoundError(
f"Path does not exist:\n" f"{path}\n{new_path}/{part} missing"
f"Path does not exist: {path}\n{new_path}{os.pathsep}{part} missing"
) from None
new_path = new_path / part
return new_path.resolve()
Expand Down

0 comments on commit 024550e

Please sign in to comment.