Skip to content

Commit

Permalink
more unique ID generation to prevent multiple attachments with same ID (
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite authored Jan 20, 2023
1 parent bbc5254 commit 3facf95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ protected function fetch(): void {
if (($id = $this->part->id) !== null) {
$this->id = str_replace(['<', '>'], '', $id);
}else{
$this->id = hash("sha256", (string)microtime(true));
$this->id = hash("sha256", uniqid((string) rand(10000, 99999), true));
}

$this->size = $this->part->bytes;
Expand Down Expand Up @@ -339,4 +339,4 @@ public function mask(string $mask = null): mixed {

throw new MaskNotFoundException("Unknown mask provided: ".$mask);
}
}
}

0 comments on commit 3facf95

Please sign in to comment.