Browse Source

Moved into existing check

improve_error_ms_for_permissions
Don Richards 2 years ago committed by GitHub
parent
commit
80391bc372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/MediaSource/MediaSourceService.php

10
src/MediaSource/MediaSourceService.php

@ -290,17 +290,11 @@ class MediaSourceService {
$directory = $this->fileSystem->dirname($content_location); $directory = $this->fileSystem->dirname($content_location);
// Check if the directory is writable. if (!$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
if (!is_writable(dirname($directory))) {
$parent_directory = dirname($directory); $parent_directory = dirname($directory);
$error_current_user = shell_exec('whoami'); $error_current_user = shell_exec('whoami');
$sanitized_current_user = str_replace(array("\n", "\r"), '', $error_current_user); $sanitized_current_user = str_replace(array("\n", "\r"), '', $error_current_user);
throw new HttpException(500, "The user '$sanitized_current_user' does not have permissions to write to: '$parent_directory' . Error"); throw new HttpException(500, "The destination directory does not exist, could not be created, or is not writable by $sanitized_current_user: $directory");
}
if (!$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
throw new HttpException(500, "The destination directory does not exist, could not be created, or is not writable: $directory");
} }
// Copy over the file content. // Copy over the file content.

Loading…
Cancel
Save