1
0
Fork 0
forked from github/pelican

Ensure path & output path comparisons are absolute

Otherwise, the following error could be returned:
"ValueError: Can't mix absolute and relative paths"
This commit is contained in:
Justin Mayer 2020-04-30 21:05:47 +02:00
commit a15f2aba76

View file

@ -100,8 +100,9 @@ class Pelican:
# Delete the output directory if (1) the appropriate setting is True # Delete the output directory if (1) the appropriate setting is True
# and (2) that directory is not the parent of the source directory # and (2) that directory is not the parent of the source directory
if (self.delete_outputdir if (self.delete_outputdir
and os.path.commonpath([self.output_path]) != and os.path.commonpath([os.path.realpath(self.output_path)]) !=
os.path.commonpath([self.output_path, self.path])): os.path.commonpath([os.path.realpath(self.output_path),
os.path.realpath(self.path)])):
clean_output_dir(self.output_path, self.output_retention) clean_output_dir(self.output_path, self.output_retention)
for p in generators: for p in generators: