-
-
Notifications
You must be signed in to change notification settings - Fork 500
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
Editing media with provider file does not work #2426
Comments
In which version does it work ? |
That is a good question. Haven't had to edit such media for 2 years. I was hoping if someone else would have the same problem to see if its new |
this is my config:
|
Is there a way to exclude the file provider to use formats as it only needs the reference format? |
I just fall into the same issue this evening. @haivala A workaround can be to use a custom edit.html.twig and add some exit statement if object.provider is file. @VincentLanglet I do not know the project very well, but do you suggest another place to fix this, as a file obviously can't have format like an image ? |
@u03c1 The thing is that it has worked before but in that 2 years period something happened. I remember that the page worked and it showed those image sizes on file provider but the links of course were 404 |
Well, my guess is that it was introduced here: https://github.com/sonata-project/SonataMediaBundle/pull/2090/files And especially with this line
I can't understand the purpose of this FORMAT_ADMIN statement, as 'format' argument seems to be useless for a file, but this can exists to respect the full implementation and contracts (?). In fact all the 'thumbnails' calls seems to be irrelevant. As a file can't have "format", I think we should always send back 'reference url' when we call generatePublicUrl(). May be the FileThumbnail can be removed and we can directly address this at the FileProvider level. In all cases for the twig part, i "think" we should remove the loop on format if the provider is "file", so we don't display unnecessary fields. As I don't know the code base and history, it's only assumptions. |
Does removing the check solves all your problems ? |
It seems to work at first glance, but I have not tested this further. I haven't a clean install of sonataAdmin 4.x installed to run the test suite. IDK if it's quick and easy to setup all and create a PR following the contributing guide. Will check when I have time. |
Environment
Sonata packages
show
Symfony packages
show
PHP version
Subject
When I try to edit media that has type file edit route does not work anymore
Minimal repository with the bug
Steps to reproduce
Expected results
You can edit it
Actual results
I have context item and it has small format but file provider should not use it.
An exception has been thrown during the rendering of a template ("Unsupported format "item_small".").
it comes from
in vendor/sonata-project/media-bundle/src/Resources/views/MediaAdmin/edit.html.twig (line 88)
The text was updated successfully, but these errors were encountered: