phacility/phabricator · error · Exception

The provided image URI must use one of these protocols: %s.

Error message

The provided image URI must use one of these protocols: %s.

What it means

Error "The provided image URI must use one of these protocols: %s." thrown in phacility/phabricator.

Source

Thrown at src/applications/files/controller/PhabricatorFileImageProxyController.php:24

  public function shouldAllowPublic() {
    return true;
  }

  public function handleRequest(AphrontRequest $request) {
    $viewer = $request->getViewer();
    $img_uri = $request->getStr('uri');

    // Validate the URI before doing anything
    PhabricatorEnv::requireValidRemoteURIForLink($img_uri);
    $uri = new PhutilURI($img_uri);
    $proto = $uri->getProtocol();

    $allowed_protocols = array(
      'http',
      'https',
    );
    if (!in_array($proto, $allowed_protocols)) {
      throw new Exception(
        pht(
          'The provided image URI must use one of these protocols: %s.',
          implode(', ', $allowed_protocols)));
    }

    // Check if we already have the specified image URI downloaded
    $cached_request = id(new PhabricatorFileExternalRequest())->loadOneWhere(
      'uriIndex = %s',
      PhabricatorHash::digestForIndex($img_uri));

    if ($cached_request) {
      return $this->getExternalResponse($cached_request);
    }

    $ttl = PhabricatorTime::getNow() + phutil_units('7 days in seconds');
    $external_request = id(new PhabricatorFileExternalRequest())
      ->setURI($img_uri)
      ->setTTL($ttl);

View on GitHub (pinned to 5720a38cfe)

When it happens

Trigger: Thrown at src/applications/files/controller/PhabricatorFileImageProxyController.php:24 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/1898e309e9883ee0. Report an issue: GitHub.