{"record":{"id":"70154453623a8062","repo":"phacility/phabricator","slug":"file-is-not-viewable","errorCode":null,"errorMessage":"File is not viewable.","messagePattern":"File is not viewable\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/pholio/controller/PholioInlineController.php","lineNumber":67,"sourceCode":"\n    $v_content = $inline->getContent();\n\n    // TODO: Not correct, but we don't always have a mock right now.\n    $mock_uri = '/';\n\n    if ($mode == 'view') {\n      require_celerity_resource('pholio-inline-comments-css');\n      $image = id(new PholioImageQuery())\n        ->setViewer($viewer)\n        ->withIDs(array($inline->getImageID()))\n        ->executeOne();\n\n      $handles = $this->loadViewerHandles(array($inline->getAuthorPHID()));\n      $author_handle = $handles[$inline->getAuthorPHID()];\n\n      $file = $image->getFile();\n      if (!$file->isViewableImage()) {\n        throw new Exception(pht('File is not viewable.'));\n      }\n\n      $image_uri = $file->getBestURI();\n\n      $thumb = id(new PHUIImageMaskView())\n        ->addClass('mrl')\n        ->setImage($image_uri)\n        ->setDisplayHeight(200)\n        ->setDisplayWidth(498)\n        ->withMask(true)\n        ->centerViewOnPoint(\n          $inline->getX(), $inline->getY(),\n          $inline->getHeight(), $inline->getWidth());\n\n      $comment_head = phutil_tag(\n        'div',\n        array(\n          'class' => 'pholio-inline-comment-head',","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/pholio/controller/PholioInlineController.php#L49-L85","documentation":"While rendering an inline Pholio comment in view mode, the controller loads the mock image's underlying Phabricator file and requires isViewableImage() - a MIME type browsers can display (png, jpeg, gif, svg, etc.). If the file record exists but its MIME type is not viewable image data, rendering aborts with a plain Exception 'File is not viewable.'. Usually the stored MIME is wrong (generic application/octet-stream) or the blob was replaced with non-image data.","triggerScenarios":"Opening an inline comment on a mock whose image file record carries a non-image MIME type; files imported/migrated without correct MIME metadata; uploads where the extension lied about content (a PDF renamed to .png).","commonSituations":"Data imports from other review tools that stored blobs without MIME; storage migrations losing metadata; corrupt or truncated uploads.","solutions":["Re-upload the image to the mock so a fresh file with a correct MIME type is created","Look up the file by PHID in the Files application and inspect its MIME type and data","If you migrated data, fix the file records to carry real MIME types (image/png, image/jpeg, ...)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check the file is actually a viewable image before rendering\n$file = $image->getFile();\nif (!$file || !$file->isViewableImage()) {\n  return $this->newDialog()->setTitle(pht('Unavailable Image'));\n}","typeGuard":"function isViewableImageFile(PhabricatorFile $file) {\n  return (bool)$file->isViewableImage();\n}","tryCatchPattern":null,"preventionTips":["Validate MIME type on upload so mock images always carry image/* types","When importing files, set correct MIME metadata on the file records","Guard rendering paths with isViewableImage() instead of assuming mock files are images"],"tags":["phabricator","pholio","files","mime-type","images"],"backgroundTag":"invalid-file-type","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}