mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-15 07:34:27 -04:00
feat: Handle empty URL case
This commit is contained in:
parent
c971e00c9c
commit
364c5752d8
2 changed files with 218 additions and 235 deletions
|
@ -57,19 +57,22 @@ class AddLinks(View):
|
|||
|
||||
def post(self, request):
|
||||
url = request.POST['url']
|
||||
print(f'[+] Adding URL: {url}')
|
||||
add_stdout = StringIO()
|
||||
with redirect_stdout(add_stdout):
|
||||
extracted_links = add(
|
||||
import_str=url,
|
||||
update_all=False,
|
||||
out_dir=OUTPUT_DIR,
|
||||
)
|
||||
print(add_stdout.getvalue())
|
||||
if url:
|
||||
print(f'[+] Adding URL: {url}')
|
||||
add_stdout = StringIO()
|
||||
with redirect_stdout(add_stdout):
|
||||
extracted_links = add(
|
||||
import_str=url,
|
||||
update_all=False,
|
||||
out_dir=OUTPUT_DIR,
|
||||
)
|
||||
print(add_stdout.getvalue())
|
||||
|
||||
context = {
|
||||
"stdout": ansi_to_html(add_stdout.getvalue())
|
||||
}
|
||||
context = {
|
||||
"stdout": ansi_to_html(add_stdout.getvalue())
|
||||
}
|
||||
else:
|
||||
context = {"stdout": "Please enter a URL"}
|
||||
|
||||
return render(template_name=self.template, request=request, context=context)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue