Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use non-canonical URL for local non-model assets #6082

Merged
merged 3 commits into from
Jun 27, 2023

Conversation

stalgiag
Copy link
Contributor

@stalgiag stalgiag commented May 16, 2023

Links for local files are broken when working locally behind newLoader flag.

This change causes the canconical URL to be retrieved for non-model local assets. This is tested locally and on my personal dev instance with *.jpg, *.glb, *.mp4, and *.mp3. It is possible that there is something that I am missing and that this is a regression so this should not be merged until I can confirm what the original intent was for limiting this behavior to model assets.

resolves #6081

@takahirox
Copy link
Contributor

Thanks for working on it.

Not ready for merge.

Please use draft PR if a PR is not ready.

@stalgiag
Copy link
Contributor Author

Thanks for working on it.

Not ready for merge.

Please use draft PR if a PR is not ready.

Yes, I have been trying to but Github is throwing 500 Errors on their servers with the "convert to draft" route. It is a known outage. I will just close for now and reopen when GH is stable again and can convert to Draft.

@@ -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");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnshaughnessy do you have any memory of why models were the only local assets that don't use a canonical URL? With the newLoader path - uploaded images, movies, and sounds are broken links when working in a local dev env.

I know this line also appears in "components/media-loader.js" which dates back to this PR.

If I make the change shown here then all media tested (glb, mp3, mp4, jpg) work with newLoader in local dev and on my personal instance. That said, I am unsure of the original intent in having non-model assets use canonical urls and don't want to introduce a regression.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asking you specifically because you were the last to work on this section. It was 9 months ago though so no worries if you don't remember.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, unfortunately no. I don't know why we made an exception only for models. But, given that we're OK with the exception for models, I can't think of why we wouldn't be OK to lift the restriction for other media types like videos and images.

At the risk of some regression, I'll go ahead with this PR (despite not understanding what lies on the other side of the fence).

@stalgiag stalgiag changed the title Use canonical URL for local non-model assets Use non-canonical URL for local non-model assets May 17, 2023
@johnshaughnessy johnshaughnessy marked this pull request as ready for review June 27, 2023 16:22
@johnshaughnessy johnshaughnessy merged commit e7d85ec into master Jun 27, 2023
10 of 12 checks passed
@johnshaughnessy johnshaughnessy deleted the local-image-fix branch June 27, 2023 16:24
@nikk15 nikk15 restored the local-image-fix branch August 11, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Media placed in room shows broken media link when working locally (newLoader)
3 participants