Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions apps/files_external/lib/Lib/Storage/SFTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,18 @@ public function opendir($path) {
public function filetype($path) {
try {
$stat = $this->getConnection()->stat($this->absPath($path));
if (!is_array($stat) || !array_key_exists('type', $stat)) {
return false;
}
/* ToDo: Investigate if NET_SFTP_TYPE_REGULAR is an available constant */
/* @phan-suppress-next-line PhanUndeclaredConstant */
if ($stat['type'] == NET_SFTP_TYPE_REGULAR) {
if ((int) $stat['type'] === NET_SFTP_TYPE_REGULAR) {
return 'file';
}

/* ToDo: Investigate if NET_SFTP_TYPE_DIRECTORY is an available constant */
/* @phan-suppress-next-line PhanUndeclaredConstant */
if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) {
if ((int) $stat['type'] === NET_SFTP_TYPE_DIRECTORY) {
return 'dir';
}
} catch (\Exception $e) {
Expand Down