Skip to content

Commit 3f2a5c9

Browse files
authored
Merge pull request #9290 from nextcloud/streams-0.6.1
Use better way to determine stream type in stream wrapper
2 parents 2d66f04 + 57ba18f commit 3f2a5c9

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/private/Files/Stream/Encryption.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ public static function wrap($source, $internalPath, $fullPath, array $header,
195195
protected static function wrapSource($source, $context, $protocol, $class, $mode = 'r+') {
196196
try {
197197
stream_wrapper_register($protocol, $class);
198-
if (@rewinddir($source) === false) {
199-
$wrapped = fopen($protocol . '://', $mode, false, $context);
200-
} else {
198+
if (self::isDirectoryHandle($source)) {
201199
$wrapped = opendir($protocol . '://', $context);
200+
} else {
201+
$wrapped = fopen($protocol . '://', $mode, false, $context);
202202
}
203203
} catch (\BadMethodCallException $e) {
204204
stream_wrapper_unregister($protocol);

0 commit comments

Comments
 (0)