mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-14 15:14:31 -04:00
Fix usage of ARCHIVE_DIR if an exisiting archive is updated
This commit is contained in:
parent
eaaba8bb04
commit
d2b8be28db
1 changed files with 3 additions and 3 deletions
6
util.py
6
util.py
|
@ -254,7 +254,7 @@ def find_link(folder, links):
|
||||||
timestamp = folder.split('.')[0]
|
timestamp = folder.split('.')[0]
|
||||||
for link in links:
|
for link in links:
|
||||||
if link['timestamp'].startswith(timestamp):
|
if link['timestamp'].startswith(timestamp):
|
||||||
if link['domain'] in os.listdir('./html/archive/' + folder):
|
if link['domain'] in os.listdir(os.path.join(ARCHIVE_DIR, 'html/archive', folder)):
|
||||||
return link # careful now, this isn't safe for most ppl
|
return link # careful now, this isn't safe for most ppl
|
||||||
if link['domain'] in parse_url(folder):
|
if link['domain'] in parse_url(folder):
|
||||||
return link
|
return link
|
||||||
|
@ -263,7 +263,7 @@ def find_link(folder, links):
|
||||||
|
|
||||||
def parse_url(folder):
|
def parse_url(folder):
|
||||||
"""for a given archive folder, figure out what url it's for"""
|
"""for a given archive folder, figure out what url it's for"""
|
||||||
link_json = os.path.join('./html/archive/' + folder, 'index.json')
|
link_json = os.path.join(ARCHIVE_DIR, 'html/archive', folder, 'index.json')
|
||||||
if os.path.exists(link_json):
|
if os.path.exists(link_json):
|
||||||
with open(link_json, 'r') as f:
|
with open(link_json, 'r') as f:
|
||||||
try:
|
try:
|
||||||
|
@ -274,7 +274,7 @@ def parse_url(folder):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print('File contains invalid JSON: {}!'.format(link_json))
|
print('File contains invalid JSON: {}!'.format(link_json))
|
||||||
|
|
||||||
archive_org_txt = os.path.join('./html/archive/' + folder, 'archive.org.txt')
|
archive_org_txt = os.path.join(ARCHIVE_DIR, 'html/archive' + folder, 'archive.org.txt')
|
||||||
if os.path.exists(archive_org_txt):
|
if os.path.exists(archive_org_txt):
|
||||||
with open(archive_org_txt, 'r') as f:
|
with open(archive_org_txt, 'r') as f:
|
||||||
original_link = f.read().strip().split('/http', 1)[-1]
|
original_link = f.read().strip().split('/http', 1)[-1]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue