Skip to content

Commit

Permalink
Merge pull request #6082 from mozilla/local-image-fix
Browse files Browse the repository at this point in the history
Use non-canonical URL for local non-model assets
  • Loading branch information
johnshaughnessy authored Jun 27, 2023
2 parents 4e19e51 + 5bcff45 commit e7d85ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/utils/media-url-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const scaledThumbnailUrlFor = (url, width, height) => {
};

export const isNonCorsProxyDomain = hostname => {
return nonCorsProxyDomains.find(domain => hostname.endsWith(domain));
return !!nonCorsProxyDomains.find(domain => hostname.endsWith(domain));
};

export const proxiedUrlFor = url => {
Expand Down
5 changes: 2 additions & 3 deletions src/utils/media-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,9 @@ export async function resolveMediaInfo(urlString) {

// We want to resolve and proxy some hubs urls, like rooms and scene links,
// but want to avoid proxying assets in order for this to work in dev environments
const isLocalModelAsset =
isNonCorsProxyDomain(url.hostname) && (guessContentType(url.href) || "").startsWith("model/gltf");
const isLocalAsset = isNonCorsProxyDomain(url.hostname);

if (url.protocol != "data:" && url.protocol != "hubs:" && !isLocalModelAsset) {
if (url.protocol != "data:" && url.protocol != "hubs:" && !isLocalAsset) {
const response = await resolveUrl(url.href);
canonicalUrl = response.origin;
if (canonicalUrl.startsWith("//")) {
Expand Down

0 comments on commit e7d85ec

Please sign in to comment.