Skip to content

Commit

Permalink
NBNP-448 Avoid moving page image files with issues already
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobSanford committed Jun 18, 2024
1 parent d85d263 commit abd6804
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,17 @@ public function movePageImageToPermanentStorage($move_file = TRUE) {
$file = $this->getPageImage();
$perm_storage_uri = $this->getPagePermImageStorageUri();

$file_uri = $file->getFileUri();
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager')->getViaUri($file_uri);
$abs_file_path = $stream_wrapper_manager->realpath();
// Do nothing if no URI or already in permanent storage.
if (
empty($perm_storage_uri) || $file->getFileUri() == $perm_storage_uri
empty($perm_storage_uri) ||
$file->getFileUri() == $perm_storage_uri ||
$abs_file_path == false ||
!file_exists($abs_file_path)
) {
// Something might be wrong. Doing stuff might make it worse.
return;
}
$file_system = \Drupal::service('file_system');
Expand Down

0 comments on commit abd6804

Please sign in to comment.