Code Duplication    Length = 6-6 lines in 2 locations

core/Controller/AvatarController.php 2 locations

@@ 191-196 (lines=6) @@
188
			if (!($node instanceof File)) {
189
				return new JSONResponse(['data' => ['message' => $this->l->t('Please select a file.')]]);
190
			}
191
			if ($node->getSize() > 20*1024*1024) {
192
				return new JSONResponse(
193
					['data' => ['message' => $this->l->t('File is too big')]],
194
					Http::STATUS_BAD_REQUEST
195
				);
196
			}
197
			$content = $node->getContent();
198
		} elseif (!is_null($files)) {
199
			if (
@@ 204-209 (lines=6) @@
201
				 is_uploaded_file($files['tmp_name'][0]) &&
202
				!\OC\Files\Filesystem::isFileBlacklisted($files['tmp_name'][0])
203
			) {
204
				if ($files['size'][0] > 20*1024*1024) {
205
					return new JSONResponse(
206
						['data' => ['message' => $this->l->t('File is too big')]],
207
						Http::STATUS_BAD_REQUEST
208
					);
209
				}
210
				$this->cache->set('avatar_upload', file_get_contents($files['tmp_name'][0]), 7200);
211
				$content = $this->cache->get('avatar_upload');
212
				unlink($files['tmp_name'][0]);