Skip to content

Commit

Permalink
Revert "Add Custom key to s3 signed storage (#120)"
Browse files Browse the repository at this point in the history
This reverts commit c558f64.
  • Loading branch information
nunomaduro committed Mar 19, 2022
1 parent 1186650 commit e35ab60
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/Http/Controllers/SignedStorageUrlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,22 @@ public function store(Request $request)

$uuid = (string) Str::uuid();

$key = $request->input('key') ?: 'tmp/'.$uuid;

$expiresAfter = config('vapor.signed_storage_url_expires_after', 5);

$signedRequest = $client->createPresignedRequest(
$this->createCommand($request, $client, $bucket, $key),
$this->createCommand($request, $client, $bucket, $key = ('tmp/'.$uuid)),
sprintf('+%s minutes', $expiresAfter)
);

$uri = $signedRequest->getUri();

$response = [
return response()->json([
'uuid' => $uuid,
'bucket' => $bucket,
'key' => $key,
'url' => $uri->getScheme().'://'.$uri->getAuthority().$uri->getPath().'?'.$uri->getQuery(),
'headers' => $this->headers($request, $signedRequest),
];

if (! $request->has('key')) {
$response['uuid'] = $uuid;
}

return response()->json($response, 201);
], 201);
}

/**
Expand Down

1 comment on commit e35ab60

@luanfreitasdev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nunomaduro !

I don't understand why the reversal of this commit, because it makes no sense to send a 10gb file to the temp folder using the browser and later move it using php. (this made it useless for large files)

Please sign in to comment.