From ed682e17eec6482e65cfe86238b50ea7cfb5c010 Mon Sep 17 00:00:00 2001 From: Guillaume Boudreau Date: Mon, 21 Feb 2022 14:43:16 -0500 Subject: [PATCH] Bugfix: modifying a file could result in a broken symlink in the LZ --- includes/Tasks/WriteTask.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/includes/Tasks/WriteTask.php b/includes/Tasks/WriteTask.php index d140be7..6ff6df3 100755 --- a/includes/Tasks/WriteTask.php +++ b/includes/Tasks/WriteTask.php @@ -31,16 +31,12 @@ public function execute() { } if (string_starts_with($this->additional_info, 'source:')) { - $source_file = substr($this->additional_info, 7); - } else { - $source_file = "$landing_zone/$full_path"; - } - - if ($this->should_ignore_file() && !string_starts_with($this->additional_info, 'source:')) { + $source_file = substr( $this->additional_info, 7 ); + } elseif ($this->should_ignore_file()) { return TRUE; } - if (!gh_file_exists($source_file, '$real_path doesn\'t exist anymore.')) { + if (!gh_file_exists(!empty($source_file) ? $source_file : "$landing_zone/$full_path", '$real_path doesn\'t exist anymore.')) { $new_full_path = static::find_future_full_path($share, $full_path, $task_id); if ($new_full_path != $full_path && gh_is_file("$landing_zone/$new_full_path")) { Log::debug(" Found that $full_path has been renamed to $new_full_path. Will work using that instead.");