Skip to content

Commit

Permalink
Use better way to determine stream type in encryption stream wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 authored and rullzer committed May 1, 2018
1 parent c27016b commit 57ba18f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/private/Files/Stream/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ public static function wrap($source, $internalPath, $fullPath, array $header,
protected static function wrapSource($source, $context, $protocol, $class, $mode = 'r+') {
try {
stream_wrapper_register($protocol, $class);
if (@rewinddir($source) === false) {
$wrapped = fopen($protocol . '://', $mode, false, $context);
} else {
if (self::isDirectoryHandle($source)) {
$wrapped = opendir($protocol . '://', $context);
} else {
$wrapped = fopen($protocol . '://', $mode, false, $context);
}
} catch (\BadMethodCallException $e) {
stream_wrapper_unregister($protocol);
Expand Down

1 comment on commit 57ba18f

@MartB
Copy link
Member

@MartB MartB commented on 57ba18f Jul 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rel: #10430
Hey @rullzer can you provide the actual implementation of isDirectoryHandle?

nvm found it on https://github.com/nextcloud/3rdparty/compare/d4e8f89af1df2e0b690ce8cae72b63e864472558...d0794726e2c370c80fbcd29d29b2291fdf9e15f8#diff-18dfcfd0e99f42951ebd8fae0baad545R47

somehow went missing in the current master.

Please sign in to comment.