umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

Rendering GLB (3D Animations) files within Umbraco with Media picker #14304

Closed NCLAMB closed 1 year ago

NCLAMB commented 1 year ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

Umbraco Cloud 11.1

Bug summary

When using a Media picker to load a GLB file, which is a 3D rendered interactive model like this https://modelviewer.dev/, when publihed the GLB file doesn't render on the page instead a 404 error shows. Seems like Umbraco doesn't recognise the .glb extension

Specifics

https://dev-saietta.euwest01.umbraco.io/products/emotor/

Steps to reproduce

Upload GLB file to media folder Create a Media picker datatype Add the doctype to a page template doctype Choose GLB file with Media Picker Publish File On the frontend the GLB file doesn't show and has a 404 error on the media file link

https://streamable.com/kewcfn

Screenshot 2023-05-26 at 00 17 07

Expected result / actual result

https://streamable.com/xi1mcl

github-actions[bot] commented 1 year ago

Hi there @NCLAMB!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

kjac commented 1 year ago

Hi @NCLAMB,

This sounds a lot like the previous issue you reported for GLB rendering. Did you go through the steps in https://github.com/umbraco/Umbraco-CMS/issues/14284#issuecomment-1558645157 - specifically adding MIME types?

I tried a quick test of adding MIME types, serving GLB files as PDF (because my test-GLB-file is really a PDF file), and that works just fine:

            var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider();

            provider.Mappings.Add(new KeyValuePair<string, string>(".glb", "application/pdf"));

            app.UseStaticFiles(new StaticFileOptions()
            {
                ContentTypeProvider = provider
            });

            app.UseStaticFiles();

Again, I do not believe this is a bug in Umbraco, but rather ASP.NET Core doing its thing, not serving files that aren't whitelisted.

harikrishna43 commented 1 year ago

provider.Mappings.Add(".glb", "model/gltf-binary"); provider.Mappings.Add(".gltf", "model/gltf+json"); this two would work