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

Media field picker failing inside a Bag #14993

Open
DJ-Paxton opened this issue Jan 5, 2024 · 6 comments
Open

Media field picker failing inside a Bag #14993

DJ-Paxton opened this issue Jan 5, 2024 · 6 comments
Labels
Milestone

Comments

@DJ-Paxton
Copy link

Hi all, I'm trying to create an information page, which will have some elements and one of those should be a list of links and attachments.

This is the structure, which is pretty basic:
image

Both the list and the bag contains the Attachment Type which contains just a Media field

image

The Media field only allows a few media types, and the PDF type is one of them.

image

So far so good, I've uploaded some files and everything seems to work fine BUT, when I try to select a file when creating content it will only show images:

image

As an example, in the previous image I created a new Information Page, and I added a new Attachment in the Bag, and when the media picker opens, it only show a jpg file, if I try to upload a file it will only allow me to upload gif, jpg, jpeg, png and svg files.

By not changing anything, if I create instead an Attachment element (same type that the Bag is using), it works just as expected:

image

As you can see, it's the same folder, but now it's showing all the documents.

As a workaround I can use a List instead of a Bag but it changes the behavior of the content creation.

I'll appreciate any help or ideas

@DJ-Paxton
Copy link
Author

If I change to All Files and try to upload an element that's already in the Media Library

image

It will say that the file type is not allowed

image

Am I missing something here? I tried allowing all default media types in the Media Field instead of selecting specific ones but it doesn't change anything.
Is like the media picker behaves differently when it's inside the Bag

@MikeAlhayek
Copy link
Member

@DJ-Paxton can you please see if PR #15017 solves your problem?

@DJ-Paxton
Copy link
Author

I found the problem:

image

So the Bag has the Attachment type, which is a Media field.
And as you can see, I have a Header Image element, which is also a Media field. So if I edit the Header Img to only allow Images. It will also limit the types inside the Media Field in the Bag.

So I created a PdfOnly field, which is a media field that you guessed it, only allows PDFs

image

And as you can see the header image only allows images

image

And if I use the PdfOnly media picker, it will show the same files to pick (images).

If I change the order in the content definition to put the PdfOnly first it will change the behavior of the media picker as well.

image

image

So it has nothing to do with the Bag, but with two different Media Fields allowing different media types working in the same Content Definition.

image

Note: I tried with the first Media Field allowing all, to see if the next ones will filter the types, but all the fields will show all the types.

@DJ-Paxton
Copy link
Author

So to sum up, and repro the issue:

  1. Create a new type with two Media Fields
    image

  2. Edit the Media Fields to allow different types each
    image


image

  1. The second Media field will allow the same types of the first one:

image

@MikeAlhayek
Copy link
Member

@ DJ-Paxton if you are using nuget packages, can you please update to the latest 1.8.1 "was released few mins ago" and see if that solved your issue?

@DJ-Paxton
Copy link
Author

@MikeAlhayek I updated the project, it changed the behavior but now it's working in the opposite way:

The first field is an Image field and the second is a Pdf Only, and it's showing only PDFs files on both Media fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants