Skip to content

Commit

Permalink
fix srcset url
Browse files Browse the repository at this point in the history
  • Loading branch information
jemikanegara committed Oct 20, 2024
1 parent 9d3aa8b commit 7451300
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/translation/startTranslationCycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function startTranslationCycle(window, node, apiKey, delay, shouldOptimize
// replace the hostname of the src with the original hostname
elementsWithRelativeSrc.forEach(el => {
// use URL class
const url = new URL(el[attr]);
const url = new URL(attr == "srcset" ? `${window.location.origin}/${el.srcset.startsWith("/") ? el.slice(1) : el}` : el.src);
url.hostname = originalWebsiteHostname;
el[attr] = url.href;
})
Expand Down

0 comments on commit 7451300

Please sign in to comment.