mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-22 14:13:01 +02:00
fix singlefile output path not relative
This commit is contained in:
@@ -99,7 +99,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, admin.ModelAdmin):
|
|||||||
list_display = ('added', 'title_str', 'url_str', 'files', 'size')
|
list_display = ('added', 'title_str', 'url_str', 'files', 'size')
|
||||||
sort_fields = ('title_str', 'url_str', 'added')
|
sort_fields = ('title_str', 'url_str', 'added')
|
||||||
readonly_fields = ('id', 'url', 'timestamp', 'num_outputs', 'is_archived', 'url_hash', 'added', 'updated')
|
readonly_fields = ('id', 'url', 'timestamp', 'num_outputs', 'is_archived', 'url_hash', 'added', 'updated')
|
||||||
search_fields = ['url', 'timestamp', 'title', 'tags__name']
|
search_fields = ['url__icontains', 'timestamp', 'title', 'tags__name']
|
||||||
fields = (*readonly_fields, 'title', 'tags')
|
fields = (*readonly_fields, 'title', 'tags')
|
||||||
list_filter = ('added', 'updated', 'tags')
|
list_filter = ('added', 'updated', 'tags')
|
||||||
ordering = ['-added']
|
ordering = ['-added']
|
||||||
|
@@ -39,7 +39,7 @@ def save_singlefile(link: Link, out_dir: Optional[Path]=None, timeout: int=TIMEO
|
|||||||
"""download full site using single-file"""
|
"""download full site using single-file"""
|
||||||
|
|
||||||
out_dir = out_dir or Path(link.link_dir)
|
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)
|
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-executable-path={}'.format(CHROME_BINARY),
|
||||||
browser_args,
|
browser_args,
|
||||||
link.url,
|
link.url,
|
||||||
output
|
output,
|
||||||
]
|
]
|
||||||
|
|
||||||
status = 'succeeded'
|
status = 'succeeded'
|
||||||
@@ -71,9 +71,9 @@ def save_singlefile(link: Link, out_dir: Optional[Path]=None, timeout: int=TIMEO
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Check for common failure cases
|
# 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)
|
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:
|
except (Exception, OSError) as err:
|
||||||
status = 'failed'
|
status = 'failed'
|
||||||
# TODO: Make this prettier. This is necessary to run the command (escape JSON internal quotes).
|
# TODO: Make this prettier. This is necessary to run the command (escape JSON internal quotes).
|
||||||
|
Reference in New Issue
Block a user