Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AuthHelper.php

function AuthHelper::isPublicBitBucketDownload

@link https://github.com/composer/composer/issues/5584

Parameters

string $urlToBitBucketFile URL to a file at bitbucket.org.:

Return value

bool Whether the given URL is a public BitBucket download which requires no authentication.

1 call to AuthHelper::isPublicBitBucketDownload()
AuthHelper::addAuthenticationHeader in vendor/composer/composer/src/Composer/Util/AuthHelper.php

File

vendor/composer/composer/src/Composer/Util/AuthHelper.php, line 291

Class

AuthHelper
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Util

Code

public function isPublicBitBucketDownload(string $urlToBitBucketFile) : bool {
    $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
    if (strpos($domain, 'bitbucket.org') === false) {
        // Bitbucket downloads are hosted on amazonaws.
        // We do not need to authenticate there at all
        return true;
    }
    $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
    // Path for a public download follows this pattern /{user}/{repo}/downloads/{whatever}
    // {@link https://blog.bitbucket.org/2009/04/12/new-feature-downloads/}
    $pathParts = explode('/', $path);
    return count($pathParts) >= 4 && $pathParts[3] === 'downloads';
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal