File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -246,14 +246,14 @@ public function is_file_readable_externally_by_storedfile(stored_file $file) {
246246 * @return bool
247247 */
248248 public function is_file_readable_externally_by_hash ($ contenthash ) {
249- if ($ contenthash === sha1 ('' )) {
250- // Files with empty size are either directories or empty.
249+ $ path = $ this ->get_external_path_from_hash ($ contenthash , false );
250+
251+ if ($ contenthash === sha1 ('' ) && is_dir ($ path )) {
252+ // Explicitly check if it is a directory, handle empty files as normal.
251253 // We handle these virtually.
252254 return true ;
253255 }
254256
255- $ path = $ this ->get_external_path_from_hash ($ contenthash , false );
256-
257257 // Note - it is not possible to perform a content recovery safely from a hash alone.
258258 return is_readable ($ path );
259259 }
You can’t perform that action at this time.
0 commit comments