Skip to content

Commit 3c6f4e4

Browse files
committed
feat: set default checksum algorithm to md5
1 parent b4a0999 commit 3c6f4e4

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/BunnyCDNAdapter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ public function fileExists(string $path): bool
494494
*/
495495
public function checksum(string $path, Config $config): string
496496
{
497-
$algo = $config->get('checksum_algo', 'sha256');
497+
// for compatibility reasons, the default checksum algorithm is md5
498+
$algo = $config->get('checksum_algo', 'md5');
498499

499500
if ($algo !== 'sha256') {
500501
return $this->calculateChecksumFromStream($path, $config);

tests/FlysystemAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,12 @@ public function get_checksum(): void
226226

227227
$this->assertSame(
228228
'3858f62230ac3c915f300c664312c63f',
229-
$adapter->checksum('path.txt', new Config(['checksum_algo' => 'md5']))
229+
$adapter->checksum('path.txt', new Config())
230230
);
231231

232232
$this->assertSame(
233233
'c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2',
234-
$adapter->checksum('path.txt', new Config())
234+
$adapter->checksum('path.txt', new Config(['checksum_algo' => 'sha256']))
235235
);
236236
}
237237

tests/PrefixTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ public function get_checksum(): void
112112

113113
$this->assertSame(
114114
'3858f62230ac3c915f300c664312c63f',
115-
$adapter->checksum('path.txt', new Config(['checksum_algo' => 'md5']))
115+
$adapter->checksum('path.txt', new Config())
116116
);
117117

118118
$this->assertSame(
119119
'c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2',
120-
$adapter->checksum('path.txt', new Config())
120+
$adapter->checksum('path.txt', new Config(['checksum_algo' => 'sha256']))
121121
);
122122
}
123123

0 commit comments

Comments
 (0)