Skip to content

Commit 65c9e34

Browse files
committed
fix(snowflakes): create file lock files into lock directory
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
1 parent 1bdc272 commit 65c9e34

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/private/Snowflake/FileSequence.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public function __construct(
3333

3434
private function ensureWorkdirExists(): void {
3535
if (is_dir($this->workDir)) {
36+
if (!is_writable($this->workDir)) {
37+
throw new \Exception('File sequence directory exists but is not writable');
38+
}
3639
return;
3740
}
3841

@@ -104,6 +107,6 @@ public function nextId(int $serverId, int $seconds, int $milliseconds): int {
104107
}
105108

106109
private function getFilePath(int $fileId): string {
107-
return $this->workDir . sprintf(self::LOCK_FILE_FORMAT, $fileId);
110+
return $this->workDir . '/' . sprintf(self::LOCK_FILE_FORMAT, $fileId);
108111
}
109112
}

0 commit comments

Comments
 (0)