Path: blob/master/src/applications/paste/controller/PhabricatorPasteRawController.php
12242 views
<?php12/**3* Redirect to the current raw contents of a Paste.4*5* This controller provides a stable URI for getting the current contents of6* a paste, and slightly simplifies the view controller.7*/8final class PhabricatorPasteRawController9extends PhabricatorPasteController {1011public function shouldAllowPublic() {12return true;13}1415public function handleRequest(AphrontRequest $request) {16$viewer = $request->getViewer();17$id = $request->getURIData('id');1819$paste = id(new PhabricatorPasteQuery())20->setViewer($viewer)21->withIDs(array($id))22->executeOne();23if (!$paste) {24return new Aphront404Response();25}2627$file = id(new PhabricatorFileQuery())28->setViewer($viewer)29->withPHIDs(array($paste->getFilePHID()))30->executeOne();31if (!$file) {32return new Aphront400Response();33}3435return $file->getRedirectResponse();36}3738}394041