1
0
Fork 0
mirror of synced 2024-09-28 23:31:09 +12:00

Merge pull request #466 from cdvv7788/hotfix/#463

fix: Escape JSON output on singlefile
This commit is contained in:
Nick Sweeting 2020-09-07 14:35:33 -04:00 committed by GitHub
commit 59a2cf1f51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

1
.gitignore vendored
View file

@ -10,6 +10,7 @@ venv/
build/
dist/
node_modules/
data/
output/

View file

@ -42,10 +42,11 @@ def save_singlefile(link: Link, out_dir: Optional[str]=None, timeout: int=TIMEOU
browser_args = chrome_args(TIMEOUT=0)
# SingleFile CLI Docs: https://github.com/gildas-lormeau/SingleFile/tree/master/cli
browser_args = '--browser-args={}'.format(json.dumps(browser_args[1:]))
cmd = [
DEPENDENCIES['SINGLEFILE_BINARY']['path'],
'--browser-executable-path={}'.format(CHROME_BINARY),
'--browser-args="{}"'.format(json.dumps(browser_args[1:])),
browser_args,
link.url,
output
]
@ -73,6 +74,8 @@ def save_singlefile(link: Link, out_dir: Optional[str]=None, timeout: int=TIMEOU
chmod_file(output)
except (Exception, OSError) as err:
status = 'failed'
# TODO: Make this prettier. This is necessary to run the command (escape JSON internal quotes).
cmd[2] = browser_args.replace('"', "\\\"")
output = err
finally:
timer.end()

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "archivebox",
"version": "0.4.19",
"version": "0.4.21",
"lockfileVersion": 1,
"requires": true,
"dependencies": {