Skip to content

Commit

Permalink
make prepareHref more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Bonomi committed Jun 12, 2024
1 parent 4a54916 commit 5536f81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions airflow_code_editor/static/airflow_code_editor.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export function basename(path) {

export function prepareHref(path) {
// Return the full path of the URL
return document.location.pathname + path;
let pathname = document.location.pathname;
pathname = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
path = path.startsWith('/') ? path.slice(1) : path;
return pathname + '/' + path;
}

export function splitPath(path) {
Expand Down

0 comments on commit 5536f81

Please sign in to comment.