From 5fdbce477a6a0d4b8892e5318cbd1f7152807c96 Mon Sep 17 00:00:00 2001 From: Levin Date: Fri, 11 Oct 2024 11:41:23 +0200 Subject: [PATCH] Only write, if file doesn't exist yet --- app/Services/PolylineStorageService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Services/PolylineStorageService.php b/app/Services/PolylineStorageService.php index a80c48103..c75bf7d66 100644 --- a/app/Services/PolylineStorageService.php +++ b/app/Services/PolylineStorageService.php @@ -18,8 +18,12 @@ public function __construct() { ]); } - public function store(string $content, string $hash = null): bool { + private function store(string $content, string $hash = null): bool { $hash = $hash ?? md5($content); + + if ($this->disk->exists($this->storageName($hash))) { + return true; + } return $this->disk->put($this->storageName($hash), $content); }