Skip to content
Snippets Groups Projects
Unverified Commit c8d47f00 authored by Dominick D'Aniello's avatar Dominick D'Aniello Committed by GitHub
Browse files

Merge pull request #667 from mozilla/feature/photo-sharing

Always resolve an absolute url for sharing
parents 52f756a0 ac595e33
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