Due to a code mistake, the expected 404 return when AJAX tries to list a directory content with a non-directory file path given, does not happen. It instead fails with another exception. This commit restores the original intention to return 404 in the first place when passing a non-directory path with the "dir" parameter. Signed-off-by: MichaIng <micha@dietpi.com>tags/v24.0.0beta1
@@ -38,7 +38,7 @@ $dir = \OC\Files\Filesystem::normalizePath($dir); | |||
try { | |||
$dirInfo = \OC\Files\Filesystem::getFileInfo($dir); | |||
if (!$dirInfo || !$dirInfo->getType() === 'dir') { | |||
if (!$dirInfo || $dirInfo->getType() !== 'dir') { | |||
http_response_code(404); | |||
exit(); | |||
} |
@@ -835,7 +835,7 @@ class Filesystem { | |||
* @param string $path | |||
* @param boolean $includeMountPoints whether to add mountpoint sizes, | |||
* defaults to true | |||
* @return \OC\Files\FileInfo|bool False if file does not exist | |||
* @return \OC\Files\FileInfo|false False if file does not exist | |||
*/ | |||
public static function getFileInfo($path, $includeMountPoints = true) { | |||
return self::$defaultInstance->getFileInfo($path, $includeMountPoints); |