Skip to content

Commit 8781a02

Browse files
Merge pull request #4 from pimjansen/feature/checksum
Throw when invalid checksum received
2 parents b570f36 + 2c1442c commit 8781a02

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/AzureBlobStorageAdapter.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function copy(string $source, string $destination, Config $config): void
283283
public function temporaryUrl(string $path, \DateTimeInterface $expiresAt, Config $config): string
284284
{
285285
$permissions = $config->get("permissions", "r");
286-
if (! is_string($permissions)) {
286+
if (!is_string($permissions)) {
287287
throw new \InvalidArgumentException("permissions must be a string!");
288288
}
289289

@@ -310,10 +310,14 @@ public function checksum(string $path, Config $config): string
310310
$properties = $this->containerClient
311311
->getBlobClient($this->prefixer->prefixPath($path))
312312
->getProperties();
313-
314-
return $properties->contentMD5;
315313
} catch (\Throwable $e) {
316314
throw new UnableToProvideChecksum($e->getMessage(), $path, $e);
317315
}
316+
317+
$md5 = $properties->contentMD5;
318+
if ($md5 === null) {
319+
throw new UnableToProvideChecksum(reason: 'File does not have a checksum set in Azure', path: $path);
320+
}
321+
return $md5;
318322
}
319323
}

0 commit comments

Comments
 (0)