Skip to content

Commit

Permalink
Only write, if file doesn't exist yet
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrLevin committed Oct 11, 2024
1 parent f65a6ee commit 5fdbce4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/Services/PolylineStorageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 5fdbce4

Please sign in to comment.