1
0
Fork 0
forked from github/pelican

Fix Windows tests

* Unskip passable tests
* Fix broken tests
This commit is contained in:
Deniz Turgut 2020-04-28 23:29:44 +03:00
commit 2e482b207b
No known key found for this signature in database
GPG key ID: 87B7168D7AB3ED2F
10 changed files with 58 additions and 41 deletions

View file

@ -27,8 +27,10 @@ logger = logging.getLogger(__name__)
def sanitised_join(base_directory, *parts):
joined = os.path.abspath(os.path.join(base_directory, *parts))
if not joined.startswith(os.path.abspath(base_directory)):
joined = posixize_path(
os.path.abspath(os.path.join(base_directory, *parts)))
base = posixize_path(os.path.abspath(base_directory))
if not joined.startswith(base):
raise RuntimeError(
"Attempted to break out of output directory to {}".format(
joined
@ -391,10 +393,9 @@ def get_relative_path(path):
def path_to_url(path):
"""Return the URL corresponding to a given path."""
if os.sep == '/':
return path
else:
return '/'.join(split_all(path))
if path is not None:
path = posixize_path(path)
return path
def posixize_path(rel_path):