- Issue created by @guignonv
In some cases, the Drupal sub-system needs to access a remote file using fseek()
(XnttStream::stream_seek()
). This works well on local files but not on remote file served through HTTP, leading to a hidden fseek(): Stream does not support seeking
error.
With some JPEG files which contain their image size beyond the first block of data read, the GD toolkit needs to do a (second) fseek() to get the info, leading to an error that is not displayed and resulting in a remote image not loaded. Therefor, an image style cannot be applied.
Note: some JPEG image will work just fine if the size is available from the first block read.
In XnttStream::stream_seek()
, check if we got a remote file and a failure when calling fseek(). When it happens, download the whole file in memory and emulate fseek behavior (other methods may need to be adjusted such as fread, feof, ...). Also, an admin setting should be added somewhere to manage the maximum size allowed for files to be downloaded that way.
Implement and test.
An admin setting somewhere to manage the maximum size of downloadable files and maybe also add restrictions on the file extensions, streams (http/ftp? has ftp also the fseek problem? need to check). Also allow extensions to override that interface/limits to provide a better UI or alter limits.
None. The XNTT stream wrapper remains the same.
Postponed
3.0
Code