Skip to content

Commit da52869

Browse files
authored
Handle files with is_file instead of file_exists
Should fix things like `fread(): read of 8192 bytes failed with errno=21 Is a directory`
1 parent 932a385 commit da52869

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/private/Files/Storage/Wrapper/Encryption.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public function fopen($path, $mode) {
391391
if ($this->util->isExcluded($fullPath) === false) {
392392
$size = $unencryptedSize = 0;
393393
$realFile = $this->util->stripPartialFileExtension($path);
394-
$targetExists = $this->file_exists($realFile) || $this->file_exists($path);
394+
$targetExists = $this->is_file($realFile) || $this->file_exists($path);
395395
$targetIsEncrypted = false;
396396
if ($targetExists) {
397397
// in case the file exists we require the explicit module as
@@ -855,7 +855,7 @@ protected function getFullPath($path) {
855855
*/
856856
protected function readFirstBlock($path) {
857857
$firstBlock = '';
858-
if ($this->storage->file_exists($path)) {
858+
if ($this->storage->is_file($path)) {
859859
$handle = $this->storage->fopen($path, 'r');
860860
$firstBlock = fread($handle, $this->util->getHeaderSize());
861861
fclose($handle);
@@ -872,7 +872,7 @@ protected function readFirstBlock($path) {
872872
protected function getHeaderSize($path) {
873873
$headerSize = 0;
874874
$realFile = $this->util->stripPartialFileExtension($path);
875-
if ($this->storage->file_exists($realFile)) {
875+
if ($this->storage->is_file($realFile)) {
876876
$path = $realFile;
877877
}
878878
$firstBlock = $this->readFirstBlock($path);
@@ -920,7 +920,7 @@ protected function parseRawHeader($rawHeader) {
920920
*/
921921
protected function getHeader($path) {
922922
$realFile = $this->util->stripPartialFileExtension($path);
923-
$exists = $this->storage->file_exists($realFile);
923+
$exists = $this->storage->is_file($realFile);
924924
if ($exists) {
925925
$path = $realFile;
926926
}

0 commit comments

Comments
 (0)