diff --git a/component_catalog/templates/component_catalog/includes/scan_package_modal.html b/component_catalog/templates/component_catalog/includes/scan_package_modal.html
index c1b8ad6b..ffd9a6e4 100644
--- a/component_catalog/templates/component_catalog/includes/scan_package_modal.html
+++ b/component_catalog/templates/component_catalog/includes/scan_package_modal.html
@@ -44,9 +44,12 @@
Scan Package
Submit Scan Request
{% else %}
-
- Submit Scan Request
-
+
{% endif %}
diff --git a/component_catalog/templates/component_catalog/modals/scan_delete_modal.html b/component_catalog/templates/component_catalog/modals/scan_delete_modal.html
index cb034ef3..16701e41 100644
--- a/component_catalog/templates/component_catalog/modals/scan_delete_modal.html
+++ b/component_catalog/templates/component_catalog/modals/scan_delete_modal.html
@@ -15,7 +15,10 @@ Delete {% trans 'Scan' %}
diff --git a/component_catalog/templates/component_catalog/modals/scan_refresh_modal.html b/component_catalog/templates/component_catalog/modals/scan_refresh_modal.html
index a60f3ad3..1b1ea361 100644
--- a/component_catalog/templates/component_catalog/modals/scan_refresh_modal.html
+++ b/component_catalog/templates/component_catalog/modals/scan_refresh_modal.html
@@ -15,7 +15,10 @@ Refresh {% trans 'Scan' %}
diff --git a/component_catalog/templates/component_catalog/scan_list.html b/component_catalog/templates/component_catalog/scan_list.html
index 98be39da..75c093e5 100644
--- a/component_catalog/templates/component_catalog/scan_list.html
+++ b/component_catalog/templates/component_catalog/scan_list.html
@@ -39,14 +39,18 @@
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.scan_delete_link').forEach(link => {
link.addEventListener('click', function() {
- let deleteUrl = this.getAttribute('data-delete-url');
- document.querySelector('#scan-delete-modal a.delete-confirm').pathname = deleteUrl;
+ let deleteUrl = new URL(this.getAttribute('data-delete-url'), window.location.origin);
+ if (deleteUrl.origin === window.location.origin) {
+ document.querySelector('#scan-delete-modal form.delete-confirm').action = deleteUrl.pathname;
+ }
});
});
document.querySelectorAll('.scan_refresh_link').forEach(link => {
link.addEventListener('click', function() {
- let refreshUrl = this.getAttribute('data-refresh-url');
- document.querySelector('#scan-refresh-modal a.refresh-confirm').pathname = refreshUrl;
+ let refreshUrl = new URL(this.getAttribute('data-refresh-url'), window.location.origin);
+ if (refreshUrl.origin === window.location.origin) {
+ document.querySelector('#scan-refresh-modal form.refresh-confirm').action = refreshUrl.pathname;
+ }
});
});
});
diff --git a/component_catalog/templates/component_catalog/tabs/tab_scan.html b/component_catalog/templates/component_catalog/tabs/tab_scan.html
index b1e07a13..7e44c083 100644
--- a/component_catalog/templates/component_catalog/tabs/tab_scan.html
+++ b/component_catalog/templates/component_catalog/tabs/tab_scan.html
@@ -13,7 +13,7 @@
{% include 'component_catalog/includes/scan_package_modal.html' %}
@@ -33,14 +33,18 @@
diff --git a/component_catalog/tests/test_views.py b/component_catalog/tests/test_views.py
index c3feac17..2d7de4f0 100644
--- a/component_catalog/tests/test_views.py
+++ b/component_catalog/tests/test_views.py
@@ -2074,6 +2074,14 @@ def test_package_details_view_scan_package_button(self):
response = self.client.get(self.package1_tab_scan_url)
self.assertContains(response, expected1)
self.assertContains(response, expected2)
+ scan_url = reverse(
+ "component_catalog:package_scan", args=[self.dataspace.name, self.package1.uuid]
+ )
+ expected_form = (
+ rf'