Skip to content

Commit

Permalink
Abort processing when user-connection aborted
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Brandscheidt <[email protected]>
  • Loading branch information
Alexander Brandscheidt committed Dec 18, 2023
1 parent 0ff6746 commit 4a00f33
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/private/Streamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
namespace OC;

use Icewind\Streams\CallBackWrapper;
use OC\Files\Filesystem;
use OCP\Files\File;
use OCP\Files\Folder;
Expand Down Expand Up @@ -126,6 +127,7 @@ public function addDirRecursive(string $dir, string $internalDir = ''): void {
/** @var LoggerInterface $logger */
$logger = \OC::$server->query(LoggerInterface::class);
foreach ($files as $file) {
if(connection_status() !== CONNECTION_NORMAL) return;
if ($file instanceof File) {
try {
$fh = $file->fopen('r');
Expand Down Expand Up @@ -161,6 +163,15 @@ public function addDirRecursive(string $dir, string $internalDir = ''): void {
* @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,

Check failure on line 168 in lib/private/Streamer.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidClass

lib/private/Streamer.php:168:13: InvalidClass: Class, interface or enum Icewind\Streams\CallBackWrapper has wrong casing (see https://psalm.dev/007)

Check failure

Code scanning / Psalm

InvalidClass Error

Class, interface or enum Icewind\Streams\CallBackWrapper has wrong casing
function ($count) use ($stream) {
if (connection_status() !== CONNECTION_NORMAL) {
fclose($stream);
}
});

$options = [];
if ($time) {
$options = [
Expand Down

0 comments on commit 4a00f33

Please sign in to comment.