Umbraco-CMS icon indicating copy to clipboard operation
Umbraco-CMS copied to clipboard

Issue with downloading certain files from Media

Open Yoadd opened this issue 3 years ago • 3 comments

Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9

9.3.1

Bug summary

Unable to download certain files after uploading them to Media.

Specifics

After uploading a .rvt file to Media and clicking the generated link - /media/x0dcaaju/1600.rvt, a Status Code: 404; Not Found is shown.

1600

Upon clicking the link: 404

Steps to reproduce

  1. Upload an .rvt file to Media.
  2. Click the generated link.

Expected result / actual result

The intended outcome is for the file to be downloaded.

It works well with common file types such as pdf, doc, png, gif, but fails to work with files such as .rvt.

Yoadd avatar Aug 08 '22 13:08 Yoadd

Hi there @Yoadd!

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'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

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:

github-actions[bot] avatar Aug 08 '22 13:08 github-actions[bot]

I'm having a similar issue with version 10.0.1. In the Startup.cs file I've added lines 49-50, 59-64 to the Configure function so I can upload .dae files: image That fixes the issue of being able to upload .dae files, however the image cropper feature then breaks because of that change. Does anyone know a solution, thanks

RichardGrimshaw avatar Aug 08 '22 14:08 RichardGrimshaw

Think I've found a solution: image

RichardGrimshaw avatar Aug 09 '22 08:08 RichardGrimshaw

Think I've found a solution: image

This works but I now can't upload pdf files to Umbraco for some reason and adding provider.Mappings[".pdf"] = "application/pdf" does not help either

Yoadd avatar Aug 18 '22 07:08 Yoadd

Hi @Yoadd,

Thanks for reaching out. My apologies for the quite belated answer.

This is a .Net Core thing; the default static file middleware knows and handles about 400 different file formats (mime type mappings). However, you can indeed add your own with app.UseStaticFiles.

The following code adds "download" mapping for .dae-files:

var provider = new FileExtensionContentTypeProvider();
provider.Mappings.Add(".dae", "application/x-msdownload");

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

Try adding that at the very end of public void Configure(IApplicationBuilder app, IWebHostEnvironment env) in Startup. When tested on V10.3.2 this seems to work just fine, and does not clash with PDF uploads/downloads or other file/image serving.

I'm going to close this issue now. I would refer you to the forum (https://our.umbraco.com/forum) if you have anymore issues with this 😄

kjac avatar Dec 14 '22 13:12 kjac