You are here

private function S3fsCorsPostObjectV4::generateUri in S3 File System CORS Upload 7

1 call to S3fsCorsPostObjectV4::generateUri()
S3fsCorsPostObjectV4::__construct in ./s3fs_cors.post_object_v4.class.inc
Constructs the PostObject.

File

./s3fs_cors.post_object_v4.class.inc, line 147
The code of classes was taken from the AWS SDK v3.180.3 and a bit modified. Next classes are used here:

Class

S3fsCorsPostObjectV4
Encapsulates the logic for getting the data for an S3 object POST upload form

Code

private function generateUri() {
  $url = Url::factory($this->client
    ->getBaseUrl());
  if ($url
    ->getScheme() === 'https' && strpos($this->bucket, '.') !== false) {

    // Use path-style URLs
    $url
      ->setPath($this->bucket);
  }
  else {

    // Use virtual-style URLs
    $url
      ->setHost($this->bucket . '.' . $url
      ->getHost());
  }
  return (string) $url;
}