mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-09-14 11:06:13 +05:00
fix: skip URL entries in save_text_as_source to prevent Path() errors
When raw_text contains URLs (e.g. from wallabag_atom parser), split() breaks them into fragments that Path() tries to read as local files. This causes spurious "No such file" errors and random paths to be accessed. Skip entries that look like URLs before checking Path.exists(). Fixes #1000
This commit is contained in:
parent
d1136d74cb
commit
5e47e055a2
@ -155,6 +155,9 @@ def save_text_as_source(raw_text: str, filename: str='{ts}-stdin.txt', out_dir:
|
||||
referenced_texts = ''
|
||||
|
||||
for entry in raw_text.split():
|
||||
# Skip URLs - Path() can't handle them and they aren't local files
|
||||
if any(entry.startswith(s) for s in ('http://', 'https://', 'ftp://')):
|
||||
continue
|
||||
try:
|
||||
if Path(entry).exists():
|
||||
referenced_texts += Path(entry).read_text()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user