umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.53k stars 2.7k forks source link

Adding custom mediatype #15719

Closed MartinTiemens closed 8 months ago

MartinTiemens commented 9 months ago

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

12.3.7

Bug summary

We like to add a new mediatype for subtitle files (.vtt) but when the data type and media type are created I'm unable to select a subtitle file.

Specifics

As a developer I like to add a new media type for subtitle files so we can give the content admins the option to add subtitles to mp4 videos. Because a subtitle is a file we like to use the media section and a media pciker for this.

Steps to reproduce

1. Create a new upload data type Create a new upload data type or duplicate an existing one. For the accepted file extensions add the expected file type, in our case vtt.

Datatype Upload Subtitle

2. Create a new media type Create a new media type or duplicate an existing one. Make sure you use the newly created data type.

Mediatype Subtitle

3. Create a property woth the new media type Add a media picker property to a document type with the newly created media type

Datatype Video Subtitle Optional

4. Add a media item Try to add the media item in content with the specific media type. When you want to selected a file it's indicated that's the wrong type and you are unable to add the specific file.

Vtt select not working

Expected result / actual result

I would have expected to add a file with the specific file extension.

The only way I can solve this issue now is to add the 'file' media type besides the custom media type.

github-actions[bot] commented 9 months ago

Hi there @MartinTiemens!

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:

andr317c commented 9 months ago

Hey! Thanks for reporting this issue. I was able to reproduce this if the Subtitle MediaType was not allowed at root, and if the Folder MediaType didn't have the Subtitle as an allowed child node type. This is expected behavior as you would never be able to create a subtitle. Is your setup the same? πŸ˜„

MartinTiemens commented 9 months ago

Hello Andr317c,

thanks for your reply. The subtitle MediaType was enable to be allowed at root but I didn't add the the MediaType under Folder rights. I've enabled the option but the problem remains.

image

To be clear about the issue, I can upload a subtitle file directly I can't select it with the media picker when I use the subtitle media type. What do you mean with it's expected behavior, shouldn't it be possible to select media files based on specific file extensions?

andr317c commented 9 months ago

Hey again! What I meant about the expected behaviour was that if you didn't have the custom mediaType as allowed at the root, and it wasn't allowed in the child nodes for the folder mediaType either. Then you would have no way of creating a Subtitle mediaType(unless it was allowed under another mediaType). But that is not the issue.

I'm currently unable to reproduce your issue πŸ˜•.

Here is a GIF of what I have done. Please let me know if I did not follow your exact steps. vttFile

If not, you can try to see if you can reproduce this issue on a clean install. If you encounter the same problem, please let me know!

MartinTiemens commented 9 months ago

Hello!

thanks for the explanation. I’ll double check it next week but as far as I can see we have the same implementation so I’m curious why it’s not working on my side. I'll create a clean and give it a shot, hopefully I see a difference.

Thanks for the help so far.

MartinTiemens commented 9 months ago

Hello @andr317c,

I've created a new project and added the media, data and document types and it worked like you described. Than I added the same things to the current project and it worked. When I compare both all types they are exactly the same. I'm confused.

andr317c commented 8 months ago

Hey again! It sure is weird πŸ˜•. However since you are not able to reproduce the bug from a clean install, I will close this issue. If you can reproduce it, please ahead and reopen this issue πŸ˜„