* ImportExport: fix not working import from http(s)

caused by trying to seek a non-seekable http steam
This commit is contained in:
ralf 2024-02-21 19:44:55 +02:00
parent 158f683e69
commit dbecc4ee84

View File

@ -528,6 +528,15 @@ class importexport_schedule_ui
{
if (($resource = @fopen( $target, $data['type'] == 'import' ? 'rb' : 'wb' )))
{
// if steam is NOT seekable (e.g. http), copy it into temp stream, which is
if ($data['type'] == 'import' && ($metadata=stream_get_meta_data($resource)) &&
!$metadata['seekable'] && ($tmp = fopen('php://temp', 'r+')))
{
stream_copy_to_stream($resource, $tmp);
fclose($resource);
fseek($tmp, 0);
$resource = $tmp;
}
$result = $po->$type( $resource, $definition );
fclose($resource);