Skip to content

Commit

Permalink
update url handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pljakobs committed Jan 3, 2025
1 parent be72f83 commit 98ddcb3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/FirmwareUpdateCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,19 @@ export default {
console.log("Selected firmware:", selectedFirmware);
try {
const baseUrl;
const fullUrl;
const relativeUrl = selectedFirmware.files.rom.url;
if (relativeUrl..substring(0, 4) !== "http") {
const baseUrl = otaUrl.value.substring(
if (relativeUrl.substring(0, 4) !== "http") {
// relative URL is server relative (has no scheme)
baseUrl = otaUrl.value.substring(
0,
otaUrl.value.lastIndexOf("/") + 1,
);
const fullUrl = baseUrl + relativeUrl;
fullUrl = baseUrl + relativeUrl;
}else{
// relative URL is not really relative, thus has the host portion
fullUrl = relativeUrl;
}
console.log("baseUrl:", baseUrl, "\nrelativeUrl: ", relativeUrl);
console.log("fullUrl: ", fullUrl);
Expand Down

0 comments on commit 98ddcb3

Please sign in to comment.