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

When dragging and dropping or selecting files, they are uploaded as a type that isn't allowed #14752

Closed
Attackmonkey opened this issue Aug 30, 2023 · 7 comments · Fixed by #14892

Comments

@Attackmonkey
Copy link
Contributor

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

10.5.1

Bug summary

It is possible to upload files in the media editor and have them created as the wrong kind of file type.

If you have an media type that accepts the PDF extension that ISN'T allowed under the current folder in the media library, the upload code attempts to create it as the media type that isn't allowed, throwing an error, rather than falling back to the generic File type.

Specifics

Error occurs in the media upload dashboard, it is caused by a bug in the file upload code I think. From looking at the code, it looks like it attempts to find the first media type that matches the file type, but it doesn't also check if that media type is allowed in the current upload location, causing "file type XXX is not allowed in this location" errors.

Steps to reproduce

Create a new file upload data type called "PDF Upload" that accepts the PDF file extension.

Create a new media type called "PDF File" that uses the PDF upload for the umbracoFile field. Make sure it is allowed at the root, but NOT underneath the media folder type.

Create a folder in your media library. Now try and drag and drop a PDF into the folder. Instead of using one if the allowed media types, the code matches to the "PDF File" media type, even though it's not allowed under the folder media type.

Expected result / actual result

As the PDF File type isn't allowed under the folder, it should fall back to the generic file media type, or any other media type that accepts PDFs that ARE allowed under the folder.

@github-actions
Copy link

Hi there @Attackmonkey!

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 🤖 🙂

@andr317c
Copy link
Contributor

Hey!

Thanks for raising this issue. I tried reproducing your issue on 10.5.1 and 10.6.1, but the error did not occur for me. Is there anything I'm missing? Please take a look at this GIF showing what I tried:
DragAndDrop

@andr317c andr317c added the state/needs-more-info We don't have enough information to give a good reply label Aug 31, 2023
@Attackmonkey
Copy link
Contributor Author

Attackmonkey commented Aug 31, 2023

OK, in your example, you have Article (which also accepts PDFs) under the folder media type. If you remove that from the allowed media types, you'll see the issue. It should try and upload as the article type, even though it isn't allowed!

So there shouldn't be either the new pdf upload or article allowed under folder!

@andr317c
Copy link
Contributor

andr317c commented Sep 3, 2023

Hey again!

Now I was able to reproduce the issue. The PDF should fall back to the generic file method as you mentioned, instead of providing the error Failed: Cannot upload this file, the media type with alias 'umbracoMediaArticle' is not allowed here. even though the generic file is still allowed in the folder. I will mark this issue as an up for grabs. 😄

@github-actions
Copy link

github-actions bot commented Sep 3, 2023

Hi @Attackmonkey,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)

@Ambertvu
Copy link
Contributor

Ambertvu commented Oct 2, 2023

Working on it

Edit: PR created

@github-actions
Copy link

github-actions bot commented Oct 3, 2023

Hi @Attackmonkey,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)

@lauraneto lauraneto linked a pull request Oct 14, 2023 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants