Closed drm-nz closed 3 years ago
PDF attachments usually work fine in Kerko, so you must have stumbled on something new or unusual. So just by changing the gmtime()
call, the file downloads normally? Could you tell me what is the version of Werkzeug in your environment, and the type and value of d
when the error happens?
That is correct, changing it to gmtime()
fixes it immediately. I guess the only downside of this is that the last modified time of the downloaded file will change every single time you download it. It will be the time of the download instead of the actual time when the file was last modified. This is with kerkoapp v0.6, I believe werkzeug is 0.16.0. Not sure what the value is but it's one of the integer_types (int or long). Cheers.
I'm wondering about the actual value of d
because it might tell a bit more about what's happening (the problem may not be in Werkzeug, but upstream in Kerko or Flask). I'm not able to reproduce the problem. Have you tried the latest Werkzeug and Flask versions, in case it is a known issue that might have been fixed?
Closing this for inactivity. Please report back if the issue persists with the latest package versions. A couple of bug fixes related to attachments were made in Kerko 0.7.
Hi There,
We have just noticed that if a publication has a PDF file attachment (presumably any attachment) then the file link returns an HTTP 500. When I reproduce the issue on the Web Server itself, I get the following error instead of the default HTTP 500 page:
It appears to me that, wherever parameter "d" is coming from, it is not in the expected format or of the expected value type. Changing line 819 in "C:\Python38\lib\site-packages\werkzeug\http.py" from "d = gmdate(d)" to "d = gmdate()" makes it immediately working. This makes me believe that either an additional check is missing from the if else block or the check "isinstance(d, (integer_types, float))" is not suitable to determine how to handle parameter "d".
Thanks, Laszlo