This commit is contained in:
A-Bran 2026-06-13 04:49:35 +02:00 committed by GitHub
commit 16636ef745
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@
namespace OC;
use Icewind\Streams\CallbackWrapper;
use OC\Files\Filesystem;
use OCP\Files\File;
use OCP\Files\Folder;
@ -126,6 +127,7 @@ class Streamer {
/** @var LoggerInterface $logger */
$logger = Server::get(LoggerInterface::class);
foreach ($files as $file) {
if(connection_status() !== CONNECTION_NORMAL) return;
if ($file instanceof File) {
try {
$fh = $file->fopen('r');
@ -161,6 +163,15 @@ class Streamer {
* @return bool $success
*/
public function addFileFromStream($stream, string $internalName, int|float $size, $time): bool {
if(connection_status() !== CONNECTION_NORMAL) return false;
// Close file-stream when user-connection closed
$stream = CallbackWrapper::wrap($stream,
function ($count) use ($stream) {
if (connection_status() !== CONNECTION_NORMAL) {
fclose($stream);
}
});
$options = [];
if ($time) {
$options = [