|
@@ 169-175 (lines=7) @@
|
| 166 |
|
if (!($node instanceof \OCP\Files\File)) { |
| 167 |
|
return new DataResponse(['data' => ['message' => $this->l->t('Please select a file.')]], Http::STATUS_OK, $headers); |
| 168 |
|
} |
| 169 |
|
if ($node->getSize() > 20*1024*1024) { |
| 170 |
|
return new DataResponse( |
| 171 |
|
['data' => ['message' => $this->l->t('File is too big')]], |
| 172 |
|
Http::STATUS_BAD_REQUEST, |
| 173 |
|
$headers |
| 174 |
|
); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
if ($node->getMimeType() !== 'image/jpeg' && $node->getMimeType() !== 'image/png') { |
| 178 |
|
return new JSONResponse( |
|
@@ 198-204 (lines=7) @@
|
| 195 |
|
is_uploaded_file($files['tmp_name'][0]) && |
| 196 |
|
!\OC\Files\Filesystem::isFileBlacklisted($files['tmp_name'][0]) |
| 197 |
|
) { |
| 198 |
|
if ($files['size'][0] > 20*1024*1024) { |
| 199 |
|
return new DataResponse( |
| 200 |
|
['data' => ['message' => $this->l->t('File is too big')]], |
| 201 |
|
Http::STATUS_BAD_REQUEST, |
| 202 |
|
$headers |
| 203 |
|
); |
| 204 |
|
} |
| 205 |
|
$this->cache->set('avatar_upload', file_get_contents($files['tmp_name'][0]), 7200); |
| 206 |
|
$content = $this->cache->get('avatar_upload'); |
| 207 |
|
unlink($files['tmp_name'][0]); |