Skip to content

Commit 8516083

Browse files
authored
Merge pull request #200 from uploadcare/feature/allow-transformation-on-copy
Update copy methods
2 parents 66233f8 + 90aa20c commit 8516083

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Apis/FileApi.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ public function batchDeleteFile($ids): BatchResponseInterface
202202
public function copyToLocalStorage($source, bool $store): FileInfoInterface
203203
{
204204
$source = (string) $source;
205-
if (!\uuid_is_valid($source)) {
205+
[$uuid, ] = \explode('/', $source);
206+
if (!\uuid_is_valid($uuid)) {
206207
throw new InvalidArgumentException(\sprintf('Uuid \'%s\' for request not valid', $source));
207208
}
208209

@@ -248,7 +249,8 @@ public function copyToRemoteStorage($source, string $target, bool $makePublic =
248249
if ($source instanceof FileInfoInterface) {
249250
$source = $source->getUuid();
250251
}
251-
if (!\uuid_is_valid($source)) {
252+
[$uuid, ] = \explode('/', $source);
253+
if (!\uuid_is_valid($uuid)) {
252254
throw new InvalidArgumentException(\sprintf('Uuid \'%s\' for request not valid', $source));
253255
}
254256

0 commit comments

Comments
 (0)