|
@@ 74-76 (lines=3) @@
|
| 71 |
|
$res = $this->server->guzzleClient()->request('GET', '/server/file/stat/' . rawurlencode($file->dirname . $file->basename)); |
| 72 |
|
|
| 73 |
|
$stat = json_decode($res->getBody()); |
| 74 |
|
if ($res->getStatusCode() !== 200 || ! isset($stat->size)) { |
| 75 |
|
throw new DisplayException('The daemon provided a non-200 error code on stat lookup: HTTP\\' . $res->getStatusCode()); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
if (! in_array($stat->mime, HelperRepository::editableFiles())) { |
| 79 |
|
throw new DisplayException('You cannot edit that type of file (' . $stat->mime . ') through the panel.'); |
|
@@ 89-91 (lines=3) @@
|
| 86 |
|
$res = $this->server->guzzleClient()->request('GET', '/server/file/f/' . rawurlencode($file->dirname . $file->basename)); |
| 87 |
|
|
| 88 |
|
$json = json_decode($res->getBody()); |
| 89 |
|
if ($res->getStatusCode() !== 200 || ! isset($json->content)) { |
| 90 |
|
throw new DisplayException('The daemon provided a non-200 error code: HTTP\\' . $res->getStatusCode()); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
return [ |
| 94 |
|
'file' => $json, |