From 7eb0c5a7577bf17398ce5c5fe72cf8578a22a1af Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 15 Sep 2025 13:59:14 +0200 Subject: [PATCH] fix(application): improve watch paths handling by trimming and filtering empty paths to prevent unnecessary triggers --- app/Models/Application.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/Models/Application.php b/app/Models/Application.php index c98d83641..0ae50edca 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -1563,7 +1563,19 @@ class Application extends BaseModel if (is_null($this->watch_paths)) { return false; } - $watch_paths = collect(explode("\n", $this->watch_paths)); + $watch_paths = collect(explode("\n", $this->watch_paths)) + ->map(function (string $path): string { + return trim($path); + }) + ->filter(function (string $path): bool { + return strlen($path) > 0; + }); + + // If no valid patterns after filtering, don't trigger + if ($watch_paths->isEmpty()) { + return false; + } + $matches = $modified_files->filter(function ($file) use ($watch_paths) { return $watch_paths->contains(function ($glob) use ($file) { return fnmatch($glob, $file);