-
Notifications
You must be signed in to change notification settings - Fork 34
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
Restricted Assets Download via request-data mechanism not working #94
Comments
Hey @galum, i just tested the zip generation by using a simple twig call and it worked perfectly fine: {{ dump(members_generate_asset_package_url([11,12], true)) }}
Did you also tried the latest dev-master? If not, please do so. We also need some more information, if the problem still exists: total file size, file type, file amount. Thanks! |
By trial and error, I figured out that the problem seems to be this:
A generated string there is for example 78 KB but the browser will then only download the first 78 bytes! I replaced it with this:
Output here: 78001 And then it is working. I assume Pimcore changed something in the getFileSize behaviour. The first argument is a boolean(!):
Edit 1: |
@galum you're right... they really changed that. jeez... (for reference: pimcore/pimcore#3885) |
fixed |
Thanks for your efforts! |
Hey @Sonja-Schubert, just released version 2.4.0! Enjoy! |
Asset Download via members/request-data/(token) mechanism seems not working any more (Pimcore 5.7.1, Members Bundle v2.3.0, PHP 7.2, Apache). Only the first few bytes of the requested files are download. The file is thus downloaded broken. The problem is most probably in how the response is created in RequestController / serveFile function:
Maybe the use of flush() is causing problems or maybe an other problem. In a quick test, I replaced the Response for download with Symfony's BinaryFileResponse and then it worked:
The function serveZip also uses a similar mechanism and may also be effected.
EDIT: I just saw that in the current version in the repository the print function in this part has been replaced with the echo function. So maybe this problem has already been solved in the latest version.
EDIT2: In a similar situation, we used StreamedResponse in the way it is documented here:
https://medium.com/@matriphe/streaming-csv-using-php-46c717e33d87
Maybe writing to $handle=fopen('php://output', 'w'); would be better than using "print" or "echo". Flush ist not used there at all in the example.
The text was updated successfully, but these errors were encountered: