sulu / SuluFormBundle

Form Bundle for handling Dynamic and Symfony Forms in https://sulu.io
MIT License
81 stars 78 forks source link

Downloading files uploaded in forms does not work #396

Open eekes opened 2 months ago

eekes commented 2 months ago
Q A
Bug? yes
New Feature? no
Bundle Version 2.5.4
Sulu Version 2.6.4

Actual Behavior

When trying to download a file uploaded in a Sulu form from here: Screenshot 2024-09-02 at 09 59 38

I get this error message:

Invalid file name "file" for media with ID "1950".

Expected Behavior

The file should be downloaded.

Steps to Reproduce

Upload a file in a Sulu form and try downloading is using the URL shown in the "Data" table

Possible Solutions

I think it has something to do with this change: https://github.com/sulu/sulu/pull/7535/files ?

alexander-schranz commented 2 months ago

You are right we are currently not replacing the /file part correctly: https://github.com/sulu/SuluFormBundle/blob/12d2df14f2af7ea2ec3e0c3cf1f1638c71325b20/ListBuilder/DynamicListBuilder.php#L132

rogamoore commented 1 week ago

We noticed the same problem. A workaround is to navigate to the corresponding collection in the media management to download the files.

@alexander-schranz Could you please explain a bit more what you mean "we are currently not replacing the /file part correctly". I could try a PR - but not sure what needs to be done to fix it.

alexander-schranz commented 1 week ago

@rogamoore I'm not sure yet how to solve this in a performant way yet as we don't have the filename here yet: https://github.com/sulu/SuluFormBundle/blob/12d2df14f2af7ea2ec3e0c3cf1f1638c71325b20/ListBuilder/DynamicListBuilder.php#L117 to replace /file with the uploaded filename.