Affects Version/s: 7.x-1.1, 7.x-1.2, 7.x-1.3, 7.x-1.4, 7.x-1.5, 7.x-1.6, 7.x-1.7, 7.x-1.8
Fix Version/s: None
Component/s: Tuque API
Validate files to write are writable in Tuque, so as to avoid potential memory issues.
Presently, if Tuque is passed a filename to which it cannot write in HttpConnection::getRequest(), it will continue to perform the request as if it was not passed a file... If dealing with large responses, this could exceed memory limitations. Additionally, code expecting the file to be written is not likely to work correctly should the response be returned into memory.
Let's fail faster, immediately when the attempt to open the file for writing fails.
It is not possible to depend on the HTTP error code, since it continues to make the request as if $file were not passed.
Attempt to download a datastream to a non-writable path, using Datastream::getContent().
Presently, this throws warnings but continues to make the request.
Following the steps to reproduce, the request should not be made when passed an invalid argument.
discoverygarden inc. | Managing Digital Content