Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(application): improve watch paths handling by trimming and filtering empty paths to prevent unnecessary triggers

Andras Bacsai7eb0c5a7577b
diff --git a/app/Models/Application.php b/app/Models/Application.php
index c98d836416..0ae50edca8 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);