Skip to content
Snippets Groups Projects
Commit ac595e33 authored by netpro2k's avatar netpro2k
Browse files

Always resolve an absolute url for sharing

parent 34d2c9a3
No related branches found
No related tags found
No related merge requests found
......@@ -36,9 +36,13 @@ export function connectToReticulum(debug = false) {
return socket;
}
export function getReticulumFetchUrl(path) {
const resolverLink = document.createElement("a");
export function getReticulumFetchUrl(path, absolute = false) {
if (process.env.RETICULUM_SERVER) {
return `https://${process.env.RETICULUM_SERVER}${path}`;
} else if (absolute) {
resolverLink.href = path;
return resolverLink.href;
} else {
return path;
}
......@@ -46,5 +50,5 @@ export function getReticulumFetchUrl(path) {
export function getLandingPageForPhoto(photoUrl) {
const parsedUrl = new URL(photoUrl);
return getReticulumFetchUrl(parsedUrl.pathname.replace(".png", ".html") + parsedUrl.search);
return getReticulumFetchUrl(parsedUrl.pathname.replace(".png", ".html") + parsedUrl.search, true);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment