Differential D8516 Diff 20210 src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | /* -( Internals )---------------------------------------------------------- */ | ||||
* @param string File data handle. | * @param string File data handle. | ||||
* @return string Absolute path to the corresponding file. | * @return string Absolute path to the corresponding file. | ||||
* @task internal | * @task internal | ||||
*/ | */ | ||||
private function getLocalDiskFileStorageFullPath($handle) { | private function getLocalDiskFileStorageFullPath($handle) { | ||||
// Make sure there's no funny business going on here. Users normally have | // Make sure there's no funny business going on here. Users normally have | ||||
// no ability to affect the content of handles, but double-check that | // no ability to affect the content of handles, but double-check that | ||||
// we're only accessing local storage just in case. | // we're only accessing local storage just in case. | ||||
if (!preg_match('@^[a-f0-9]{2}/[a-f0-9]{2}/[a-f0-9]{28}$@', $handle)) { | if (!preg_match('@^[a-f0-9]{2}/[a-f0-9]{2}/[a-f0-9]{28}\z@', $handle)) { | ||||
throw new Exception( | throw new Exception( | ||||
"Local disk filesystem handle '{$handle}' is malformed!"); | "Local disk filesystem handle '{$handle}' is malformed!"); | ||||
} | } | ||||
$root = $this->getLocalDiskFileStorageRoot(); | $root = $this->getLocalDiskFileStorageRoot(); | ||||
return $root.'/'.$handle; | return $root.'/'.$handle; | ||||
} | } | ||||
} | } |