Closed automatedChaos closed 1 month ago
To be honest. I'm refactoring the Media gallery to Vue 3 right now in a PR. This will probably change the way we initialize the Media Gallery entirely. I would rather invest time there than on the actual one.
This bug is also impacting an application I'm working on as well. In my case, I have a single content item with two media fields (one for picking a PDF, the other a thumbnail) and the allowed extensions on the first media field are being applied to both. Problematic since these media fields need the user to pick two entirely different types of media (document vs. image).
Some more context: https://github.com/OrchardCMS/OrchardCore/issues/16440
Describe the bug
When adding multiple content items that each contain a media field to a flow part only the last media field's preferences are applied to all media fields. This is particularly inconvenient if the last media field has format preferences such as being constrained to only video formats. All of the other media fields will then also limit the user to selecting video.
To Reproduce
Steps to reproduce the behavior Using the blog example theme:
Create a new 'Video' Content Item with a media field restricted to video formats Content Item:
Media Field:
![image](https://github.com/OrchardCMS/OrchardCore/assets/785693/b99195ef-6596-4229-b373-224251dd28ae)
Add a new Page to the blog
Add a Video Content Item to the Page flow part
Add an Image Content Item to the Page flow part
Add a video to the video content item
Attempt to add an image to the Image content item but the media field for the image Content Item will be constrained by the video media field preferences
Expected behavior
It was expected that the image media field would accept any file to upload to the media library and image files in the media library would be visible to select. This is not the case and instead, all that is visible are video files.
Screenshots
Media library when the Video Content Item is present on the page![image](https://github.com/OrchardCMS/OrchardCore/assets/785693/68e1ca1a-4f87-473a-8511-df444d230f72)
Media library when the Video Content Item has been deleted and the page refreshed.![image](https://github.com/OrchardCMS/OrchardCore/assets/785693/e694a5b5-fc81-4209-8fff-3e002ee6df52)
It looks like the MediaApplication Vue app is a singleton and initialised once for the first media field. The mediaApplicationUrl is then never updated again so the listed files are always the same. I am happy to spend some time working out a fix if it is agreed that I am heading in the right direction.