- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/bitrix24disk/legacy/storagecontroller.php
- Класс: BitrixDiskBitrix24DiskLegacyStorageController
- Вызов: StorageController::processActionGetPublicLink
protected function processActionGetPublicLink()
{
$this->checkRequiredPostParams(array('id', 'extra', 'storageExtra', 'storageId'));
if($this->errorCollection->hasErrors())
{
$this->sendJsonErrorResponse();
}
$id = $this->request->getPost('id');
$storage = $this->getStorageObject($this->request->getPost('storageExtra'), $this->request->getPost('storageId'));
$extra = $storage->parseElementExtra($this->request->getPost('extra'));
$object = $storage->getFile($id, $extra);
if (!$object)
{
$object = $storage->getDirectory($id, $extra);
}
//not found or we have new version
if(!$object)
{
$this->sendJsonResponse(array(
'status' => static::STATUS_NOT_FOUND,
));
}
$publicLink = $storage->getPublicLink($object);
if ($publicLink)
{
$storage->clearErrors();
}
$this->sendJsonSuccessResponse(array(
'link' => $publicLink,
));
}