{"record":{"id":"a4e5c105dd087f27","repo":"phacility/phabricator","slug":"too-many-redirects-trying-to-fetch-remote-uri","errorCode":null,"errorMessage":"Too many redirects trying to fetch remote URI.","messagePattern":"Too many redirects trying to fetch remote URI\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/storage/PhabricatorFile.php","lineNumber":597,"sourceCode":"\n\n  /**\n   * Download a remote resource over HTTP and save the response body as a file.\n   *\n   * This method respects `security.outbound-blacklist`, and protects against\n   * HTTP redirection (by manually following \"Location\" headers and verifying\n   * each destination). It does not protect against DNS rebinding. See\n   * discussion in T6755.\n   */\n  public static function newFromFileDownload($uri, array $params = array()) {\n    $timeout = 5;\n\n    $redirects = array();\n    $current = $uri;\n    while (true) {\n      try {\n        if (count($redirects) > 10) {\n          throw new Exception(\n            pht('Too many redirects trying to fetch remote URI.'));\n        }\n\n        $resolved = PhabricatorEnv::requireValidRemoteURIForFetch(\n          $current,\n          array(\n            'http',\n            'https',\n          ));\n\n        list($resolved_uri, $resolved_domain) = $resolved;\n\n        $current = new PhutilURI($current);\n        if ($current->getProtocol() == 'http') {\n          // For HTTP, we can use a pre-resolved URI to defuse DNS rebinding.\n          $fetch_uri = $resolved_uri;\n          $fetch_host = $resolved_domain;\n        } else {","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/storage/PhabricatorFile.php#L579-L615","documentation":"Error \"Too many redirects trying to fetch remote URI.\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/files/storage/PhabricatorFile.php:597 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}