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

10.3.0-RC: Image upload skips select media ContentType #13210

Closed
rammi987 opened this issue Oct 14, 2022 · 17 comments · Fixed by #13780
Closed

10.3.0-RC: Image upload skips select media ContentType #13210

rammi987 opened this issue Oct 14, 2022 · 17 comments · Fixed by #13780

Comments

@rammi987
Copy link
Contributor

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

10.3.0-RC3

Bug summary

When you have multiple media ContentTypes and upload an file, through Media Section dropzone or through Media picker 3 Upload button. This image just gets upload right away, but at the same time a modal is shown to prompt witch type you´re trying to upload.

Either the modal is just trap forever and can never be closed, else you pick you media type, and it closes, but the file has already been upload and a type autopicked based on what Umbraco tells it that it should be "In our cases Image instead Video Image"

I have testede it and can see the bug has been present since 10.1.0 (maybe earlier).

Specifics

No response

Steps to reproduce

See video
screen-capture.webm

create a new media contentType (just a copy of image).
go to media section and upload an image.

The media is now upload before I picked a type. (Our new type) so the media is now an type of Images.

The same error is also present in the mediapicker dialog.

Expected result / actual result

I expected it to try to upload the media, but before that, the modal stops my and force me to pick an type.
The media is now uploaded in the picked type as you choose.

@github-actions
Copy link

Hi there @rammi987!

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

@rammi987 rammi987 changed the title Image upload skips select media ContentType 10.3.0-RC: Image upload skips select media ContentType Oct 14, 2022
@iOvergaard
Copy link
Contributor

iOvergaard commented Nov 22, 2022

Hi @rammi987 thanks for your feedback and your suggested fix.

We are going to revamp/refactor the dropzone directive into using our newer drag&drop functionality which was built for the Media Picker property editor with #13393.

This is currently being tracked internally at HQ and we will provide a fix.

Internal ref: AB#24262

@sniffdk
Copy link
Contributor

sniffdk commented Feb 2, 2023

@iOvergaard how far along is this fix ? We would have expected it to be included in the 11.1 release at least.
One thing is that our editors now have to manually upload 300 svg icons, as the drag-n-drop insists on uploading them as images instead of svg's.
Another is, that it completely bypasses file type validation and happily allows uploads of any file type like .dll, .exe etc. which is kind of a security issue.
Hope to have an update very soon 👍

@iOvergaard
Copy link
Contributor

Hi @sniffdk

Sorry that the fix was not released when you expected it to be. The bug report will get a label like "release-11.x.x" when we know which version it will target.

Regarding your description of SVGs being uploaded as images, I cannot see a correlation between the original bug report and what you describe. It rather sounds like you have found another bug. Looking in the issue tracker, it would seem there has been a few issues surrounding SVGs - mainly that they were uploaded as the 'File' type #10320 and then later the 'SVG' type was added #10604.

Disregarding the fact that the media type picker dialog does not work at the moment, SVGs should still work if there is only one SVG type. Do you allow SVGs on more than one media type?

Regarding your description of uploading arbitrary files such as DLLs and executables, I am going to make a bug report regarding this on your behalf, so we can look into that.

@sniffdk
Copy link
Contributor

sniffdk commented Feb 2, 2023

Hi @iOvergaard

Thanks for getting back to me. This bug repport states that:
"When you have multiple media ContentTypes and upload an file, through Media Section dropzone or through Media picker 3 Upload button. This image just gets upload right away, but at the same time a modal is shown to prompt witch type you´re trying to upload."

This is consistent with what we are experiencing. And yes, we allow svg's on more than one media type, hence why we need the media type picker to actually work 😄
It is also what kickstarts the bug and disables file type validation, if we only allow svg's on one media type, it works as expected, as it just picks that one.

Thanks for creating the bug rapport for me, it's appreciated 😃

@sniffdk
Copy link
Contributor

sniffdk commented Feb 2, 2023

To better illustrate the problem, we have our folder permissions setup like this:
image
The circled media types both use the same "Upload Vector Graphics" datatype which uses an Upload File property editor with the accepted file type set to svg:
image

Tests on another Umbraco installation shows us, that removing one of them removes the problem, however that is not an ideal workaround to say the least 😅

@iOvergaard
Copy link
Contributor

This is consistent with what we are experiencing. And yes, we allow svg's on more than one media type, hence why we need the media type picker to actually work

I hear what you are saying. I believe the media library should at least pick the first relevant media type (which would be Vector Graphics (SVG) in your case) even though the "choose a type" dialog does not work, but as I understand it from your description it does not even do that hence the new bug report.

This bug report remains on our board and will be fixed as soon as possible.

@sniffdk
Copy link
Contributor

sniffdk commented Feb 3, 2023

It does actually just select the first relevant media type, which for svg is the build-in Image media type, that uses the Image Cropper data type. I assume that svg, as an allowed file extension, is hardcoded into that data type somewhere. The problem here being that the dialog doesn't work, so we can't choose to upload the svg as any other media type, when more than one is allowed to be created under the Folder media type.

I do hope we can have a fix for this in the next minor release 👍

@iOvergaard
Copy link
Contributor

iOvergaard commented Feb 3, 2023

@sniffdk Interesting 🤔

It seems like the frontend falls back to type=Image whenever it can't determine it automatically. SVGs then sort of work with the Image type (at least the preview works) and you might not notice anything wrong.

I just did a test and found that if the dialog works and you choose the "Autopick" option to let the server determine the type, then it selects the default "Vector Graphics (SVG)" type as would be expected.

I'll be sure to include a "fix" for this!

@sniffdk
Copy link
Contributor

sniffdk commented Feb 3, 2023

That is interesting behavior all around 😅
Thanks for looking into it, it will be good to have this fixed "soon" 😄

@rammi987
Copy link
Contributor Author

rammi987 commented Feb 6, 2023

Hello @iOvergaard

I acculty did as fix along this bug request #13211, for at fast issue fix, to Umbraco 11.2 ;)

@iOvergaard
Copy link
Contributor

iOvergaard commented Feb 6, 2023

@rammi987 Yes you did. I think it is an acceptable solution until we merge the logic in MediaPicker with the Media Library. I tried on Friday to reopen your pull request, but unfortunately, our main branch has been renamed since then and the pull request is permanently closed. I have picked your proposed solution and some other stuff in a new PR #13780 and once it passes review, it should land in 11.2.0.

@rammi987
Copy link
Contributor Author

rammi987 commented Feb 6, 2023

@iOvergaard Make sense! But can you inlight me in what the future holds? In the PR request of my, you metion a internal task, witch I not was allow to see, about something due to the upload?. So is the src/Umbraco.Web.UI.Client/src/common/directives/components/upload/umbfiledropzone.directive.js gone for god or complete rewriten and when is the new Upload area set to be release eta?

@iOvergaard
Copy link
Contributor

Yes sure, @rammi987. It's not quite that drastic. In short, we have two areas now where we are executing roughly the same logic: The Umbraco.MediaPicker3 property editor, and the media library. They both contain functionality for auto-selecting media types and deciding if the user should be shown the media type picker dialog. They also contain some logic to notify the user that an upload completed. We simply want to merge the two, i.e. making the media library using the newer logic from the media picker, which conversely would have fixed this bug as well.

The dropzone directive will stay, and in fact, I would like for that to be the only way you enable drag&drop for media on any element.

There is no release date, and as you said, we are tracking the feature internally at the moment. With the new backoffice slated for v13 later this year, the entire thing will be rewritten anyway, so at least from v13 on it will be different.

Hope that was a useful answer 😇

@iOvergaard
Copy link
Contributor

Thanks for the report again. The bug fix has now been merged and is slated for Umbraco 11.2.0!

@sniffdk
Copy link
Contributor

sniffdk commented Feb 6, 2023

@iOvergaard Thank you for the quick replies and fast action on these, it's much appreciated ❤️‍🔥

@rammi987
Copy link
Contributor Author

rammi987 commented Feb 6, 2023

@iOvergaard Thansk for the cleary response on what the further will hold. I´ll meaby tag you in a futher bug report. Due to me and @sniffdk fund meaby found something else with the autoselect function. I´ll test both the dropdown as it is and the logic you showcase my! I´ll due the test on a 11.2 ;) So thx for now this I know was something witch was highly appreciated!

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.

5 participants