|
@@ 128-134 (lines=7) @@
|
| 125 |
|
if (!($node instanceof \OCP\Files\File)) { |
| 126 |
|
return new DataResponse(['data' => ['message' => $this->l->t('Please select a file.')]], Http::STATUS_OK, $headers); |
| 127 |
|
} |
| 128 |
|
if ($node->getSize() > 20*1024*1024) { |
| 129 |
|
return new DataResponse( |
| 130 |
|
['data' => ['message' => $this->l->t('File is too big')]], |
| 131 |
|
Http::STATUS_BAD_REQUEST, |
| 132 |
|
$headers |
| 133 |
|
); |
| 134 |
|
} |
| 135 |
|
$content = $node->getContent(); |
| 136 |
|
} elseif ($files !== null) { |
| 137 |
|
if ( |
|
@@ 142-148 (lines=7) @@
|
| 139 |
|
$this->isUploadFile($files['tmp_name'][0]) && |
| 140 |
|
!Filesystem::isForbiddenFileOrDir($files['tmp_name'][0]) |
| 141 |
|
) { |
| 142 |
|
if ($files['size'][0] > 20*1024*1024) { |
| 143 |
|
return new DataResponse( |
| 144 |
|
['data' => ['message' => $this->l->t('File is too big')]], |
| 145 |
|
Http::STATUS_BAD_REQUEST, |
| 146 |
|
$headers |
| 147 |
|
); |
| 148 |
|
} |
| 149 |
|
$this->cache->set('avatar_upload', \file_get_contents($files['tmp_name'][0]), 7200); |
| 150 |
|
$content = $this->cache->get('avatar_upload'); |
| 151 |
|
\unlink($files['tmp_name'][0]); |