{"record":{"id":"dc04cfef2015d5f5","repo":"phacility/phabricator","slug":"you-must-save-a-file-before-you-can-generate-a-vie","errorCode":null,"errorMessage":"You must save a file before you can generate a view URI.","messagePattern":"You must save a file before you can generate a view URI\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/storage/PhabricatorFile.php","lineNumber":830,"sourceCode":"\n    $format = $this->newStorageFormat();\n\n    $iterator = $engine->getRawFileDataIterator(\n      $this,\n      $begin,\n      $end,\n      $format);\n\n    return $iterator;\n  }\n\n  public function getURI() {\n    return $this->getInfoURI();\n  }\n\n  public function getViewURI() {\n    if (!$this->getPHID()) {\n      throw new Exception(\n        pht('You must save a file before you can generate a view URI.'));\n    }\n\n    return $this->getCDNURI('data');\n  }\n\n  public function getCDNURI($request_kind) {\n    if (($request_kind !== 'data') &&\n        ($request_kind !== 'download')) {\n      throw new Exception(\n        pht(\n          'Unknown file content request kind \"%s\".',\n          $request_kind));\n    }\n\n    $name = self::normalizeFileName($this->getName());\n    $name = phutil_escape_uri($name);\n","sourceCodeStart":812,"sourceCodeEnd":848,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/storage/PhabricatorFile.php#L812-L848","documentation":"Error \"You must save a file before you can generate a view URI.\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/files/storage/PhabricatorFile.php:830 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"}