Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/controller/PholioImageUploadController.php
Show All 12 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$file = id(new PhabricatorFileQuery()) | $file = id(new PhabricatorFileQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withPHIDs(array($phid)) | ->withPHIDs(array($phid)) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$file) { | if (!$file) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
if (!strlen($title)) { | if (!phutil_nonempty_string($title)) { | ||||
valerio.bozzolan: ✅ I verified the above line
The `$title` comes from `Aphront#getStr()` that always return a… | |||||
$title = $file->getName(); | $title = $file->getName(); | ||||
} | } | ||||
$image = PholioImage::initializeNewImage() | $image = PholioImage::initializeNewImage() | ||||
->setAuthorPHID($viewer->getPHID()) | ->setAuthorPHID($viewer->getPHID()) | ||||
->attachFile($file) | ->attachFile($file) | ||||
->setName($title) | ->setName($title) | ||||
->setDescription($description) | ->setDescription($description) | ||||
Show All 15 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ I verified the above line
The $title comes from Aphront#getStr() that always return a string or null.
The function phutil_nonempty_string() will report any other alien value, and that is OK.