diff --git a/archivebox/core/views.py b/archivebox/core/views.py index 0bb98752..d2de7cbe 100644 --- a/archivebox/core/views.py +++ b/archivebox/core/views.py @@ -1412,8 +1412,15 @@ class WebAddView(AddView): if snapshot: return redirect(f"/{snapshot.url_path}") + request_host = (request.get_host() or "").lower() + if ( + request.user.is_authenticated + and not _get_request_config(request).PUBLIC_ADD_VIEW + and host_matches(request_host, get_web_host()) + ): + return redirect(build_admin_url(request.get_full_path(), request=request)) + if not self.test_func(): - request_host = (request.get_host() or "").lower() if host_matches(request_host, get_web_host()): return redirect(build_admin_url(request.get_full_path(), request=request)) if host_matches(request_host, get_admin_host()): diff --git a/archivebox/tests/test_ui_admin_links.py b/archivebox/tests/test_ui_admin_links.py index 2315040e..874f114d 100644 --- a/archivebox/tests/test_ui_admin_links.py +++ b/archivebox/tests/test_ui_admin_links.py @@ -138,7 +138,7 @@ def test_archiveresult_admin_links_plugin_and_process(): process_html = str(admin.process_link(result)) assert "/admin/environment/plugins/builtin.wget/" in plugin_html - assert f"/admin/machine/process/{process.id}/change" in process_html + assert f"/admin/machine/process/{process.id.hex}/change" in process_html def test_deleting_binary_and_process_records_preserves_results():