|
|
@@ -39,7 +39,7 @@ def save_singlefile(link: Link, out_dir: Optional[Path]=None, timeout: int=TIMEO
|
|
|
"""download full site using single-file"""
|
|
|
|
|
|
out_dir = out_dir or Path(link.link_dir)
|
|
|
- output = str(out_dir.absolute() / "singlefile.html")
|
|
|
+ output = "singlefile.html"
|
|
|
|
|
|
browser_args = chrome_args(TIMEOUT=0)
|
|
|
|
|
|
@@ -50,7 +50,7 @@ def save_singlefile(link: Link, out_dir: Optional[Path]=None, timeout: int=TIMEO
|
|
|
'--browser-executable-path={}'.format(CHROME_BINARY),
|
|
|
browser_args,
|
|
|
link.url,
|
|
|
- output
|
|
|
+ output,
|
|
|
]
|
|
|
|
|
|
status = 'succeeded'
|
|
|
@@ -71,9 +71,9 @@ def save_singlefile(link: Link, out_dir: Optional[Path]=None, timeout: int=TIMEO
|
|
|
)
|
|
|
|
|
|
# Check for common failure cases
|
|
|
- if (result.returncode > 0):
|
|
|
+ if (result.returncode > 0) or not (out_dir / output).is_file():
|
|
|
raise ArchiveError('SingleFile was not able to archive the page', hints)
|
|
|
- chmod_file(output)
|
|
|
+ chmod_file(output, cwd=str(out_dir))
|
|
|
except (Exception, OSError) as err:
|
|
|
status = 'failed'
|
|
|
# TODO: Make this prettier. This is necessary to run the command (escape JSON internal quotes).
|