Skip to content

Commit

Permalink
Fix the pipeline details fetch for URLs with credentials #998 (#1048)
Browse files Browse the repository at this point in the history
* Fix the pipeline details fetch for URLs with credentials #998

Signed-off-by: tdruez <[email protected]>

* Remove the console.log debug statement #998

Signed-off-by: tdruez <[email protected]>

---------

Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez authored Jan 16, 2024
1 parent 7f3ad87 commit 09217dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ v33.0.0 (unreleased)
project pipeline.
https://github.com/nexB/scancode.io/issues/997

- Fix an issue where the pipeline details cannot be fetched when using URLs that
include credentials such as "user:pass@domain".
https://github.com/nexB/scancode.io/issues/998

v32.7.0 (2023-10-25)
--------------------

Expand Down
11 changes: 9 additions & 2 deletions scanpipe/templates/scanpipe/modals/run_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
if (modal_id !== "run-detail-modal") return;

let $modal = document.getElementById(modal_id);
let run_uuid = event.detail.$button.dataset.uuid;
let run_detail_url = `/run/${run_uuid}/`;
$modal.innerHTML = "";

let run_uuid = event.detail.$button.dataset.uuid;
let run_detail_path = `/run/${run_uuid}/`;

// Construct the full URL by combining the current origin and the relative path.
// It's important to use the URL constructor, as directly providing the relative
// path to the `fetch` function may not work correctly, especially for URLs
// that include credentials such as "user:[email protected]".
let run_detail_url = new URL(run_detail_path, window.location.origin);

fetch(run_detail_url).then(function (response) {
if (response.ok) {
return response.text();
Expand Down

0 comments on commit 09217dd

Please sign in to comment.