Skip to content

Commit

Permalink
Re-introduce MD5 hashes for Flow 6.x and earlier
Browse files Browse the repository at this point in the history
This change reverts the removal of MD5 support, which is supported by
Flow 6.x and earlier.

Resolves #25
  • Loading branch information
robertlemke committed Jan 25, 2021
1 parent 8d4716e commit b86adbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Classes/GcsStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ protected function importTemporaryFile(string $temporaryPathAndFilename, string
$resource->setCollectionName($collectionName);
$resource->setSha1($sha1Hash);

# Provide compatibility with Flow 6.x and earlier:
if (method_exists($resource, 'setMd5')) {
$resource->setMd5(md5_file($temporaryPathAndFilename));
}

$bucket = $this->getCurrentBucket();
if (!$bucket->object($this->keyPrefix . $sha1Hash)->exists()) {
try {
Expand Down
4 changes: 4 additions & 0 deletions Classes/GcsTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,10 @@ public function getPublicPersistentResourceUri(PersistentResource $resource): st
'{fileExtension}' => $resource->getFileExtension()
];

if (method_exists($resource, 'getMd5')) {
$variables['{md5}'] = $resource->getMd5();
}

foreach ($variables as $placeholder => $replacement) {
$customUri = str_replace($placeholder, $replacement, $customUri);
}
Expand Down

0 comments on commit b86adbe

Please sign in to comment.