mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
fix downloads via WebDAV of backups stored in S3, caused by slightly wrong Content-Size header, due to encryption of backups
This commit is contained in:
parent
12f3d3a8ee
commit
16b98ce4d1
@ -403,7 +403,7 @@ class HTTP_WebDAV_Server_Filesystem extends HTTP_WebDAV_Server
|
||||
// detect modification time
|
||||
// see rfc2518, section 13.7
|
||||
// some clients seem to treat this as a reverse rule
|
||||
// requiering a Last-Modified header if the getlastmodified header was set
|
||||
// requiring a Last-Modified header if the getlastmodified header was set
|
||||
$options['mtime'] = filemtime($fspath);
|
||||
|
||||
// detect resource size
|
||||
@ -436,6 +436,16 @@ class HTTP_WebDAV_Server_Filesystem extends HTTP_WebDAV_Server
|
||||
// no need to check result here, it is handled by the base class
|
||||
$options['stream'] = fopen($fspath, "r");
|
||||
|
||||
// hack to fix downloads from s3direct stream-wrapper reporting slightly wrong sizes in stat calls due to encryption
|
||||
if (class_exists('EGroupware\Api\Vfs') &&
|
||||
($url=EGroupware\Api\Vfs::resolve_url($options['path'])) &&
|
||||
str_starts_with($url, 'stylite.s3direct://'))
|
||||
{
|
||||
fseek($options['stream'], 0, SEEK_END);
|
||||
$options['size'] = ftell($options['stream']);
|
||||
fseek($options['stream'], 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user