diff --git a/core/includes/file.inc b/core/includes/file.inc index c2152cb..0758459 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -332,7 +332,8 @@ function file_prepare_directory(&$directory, $options = FILE_MODIFY_PERMISSIONS) function file_directory_is_writable($uri) { // By converting the URI to a normal path using drupal_realpath(), we can // correctly handle both stream wrappers and normal paths. - return is_writable(drupal_realpath($uri)) && drupal_is_executable($uri); + $realpath = \Drupal::service('file_system')->realpath($uri); + return is_writable($realpath ? $realpath : $uri) && drupal_is_executable($uri); } /** @@ -353,7 +354,10 @@ function file_directory_is_writable($uri) { function drupal_is_executable($uri) { // By converting the URI to a normal path using drupal_realpath(), we can // correctly handle both stream wrappers and normal paths. - return is_executable(drupal_realpath($uri)); + $realpath = \Drupal::service('file_system')->realpath($uri); + $filename = $realpath ? $realpath : $uri; + // Determine whether the URI is an executable file or a directory. + return is_executable($filename) || is_dir($filename); } /**