Page MenuHomePhorge

PhabricatorPasteRawController.php
No OneTemporary

Size
922 B
Referenced Files
None
Subscribers
None

PhabricatorPasteRawController.php

<?php
/**
* Redirect to the current raw contents of a Paste.
*
* This controller provides a stable URI for getting the current contents of
* a paste, and slightly simplifies the view controller.
*/
final class PhabricatorPasteRawController
extends PhabricatorPasteController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$paste = id(new PhabricatorPasteQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$paste) {
return new Aphront404Response();
}
$file = id(new PhabricatorFileQuery())
->setViewer($viewer)
->withPHIDs(array($paste->getFilePHID()))
->executeOne();
if (!$file) {
return new Aphront400Response();
}
return $file->getRedirectResponse();
}
}

File Metadata

Mime Type
text/x-php
Expires
Wed, May 7, 3:07 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
83248
Default Alt Text
PhabricatorPasteRawController.php (922 B)

Event Timeline