From 69e0302c2a37117ed64c3a53d5c8030a529b4d3c Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Thu, 18 Feb 2021 02:34:03 -0500 Subject: [PATCH] only add https to url if needed when prompting to save new snapshot --- archivebox/core/views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/archivebox/core/views.py b/archivebox/core/views.py index 539d029c..f4a976ea 100644 --- a/archivebox/core/views.py +++ b/archivebox/core/views.py @@ -159,11 +159,13 @@ class SnapshotView(View): format_html( ( '



' - 'No Snapshots match the given url: {}

' - 'You can add a new Snapshot, or return to the Main Index' + 'No Snapshots match the given url: {}


' + 'Return to the Main Index, or:

' + '+ Add a new Snapshot for {}

' '
' ), base_url(path), + path if '://' in path else f'https://{path}', path, ), content_type="text/html", @@ -241,9 +243,9 @@ class AddView(UserPassesTestMixin, FormView): if self.request.method == 'GET': url = self.request.GET.get('url', None) if url: - return {'url': url} - else: - return super().get_initial() + return {'url': url if '://' in url else f'https://{url}'} + + return super().get_initial() def test_func(self): return PUBLIC_ADD_VIEW or self.request.user.is_authenticated