Code Duplication    Length = 6-6 lines in 2 locations

apps/files_sharing/api/local.php 2 locations

@@ 68-73 (lines=6) @@
65
			return new \OC_OCS_Result(null, 404, 'could not get shares');
66
		} else {
67
			foreach ($shares as &$share) {
68
				if ($share['item_type'] === 'file' && isset($share['path'])) {
69
					$share['mimetype'] = \OC_Helper::getFileNameMimeType($share['path']);
70
					if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
71
						$share['isPreviewAvailable'] = true;
72
					}
73
				}
74
75
				if (!is_null($share['token'])) {
76
					$share['url'] = \OC::$server->getURLGenerator()->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $share['token']]);
@@ 231-236 (lines=6) @@
228
		try	{
229
			$shares = \OCP\Share::getItemsSharedWith('file');
230
			foreach ($shares as &$share) {
231
				if ($share['item_type'] === 'file') {
232
					$share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']);
233
					if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
234
						$share['isPreviewAvailable'] = true;
235
					}
236
				}
237
			}
238
			$result = new \OC_OCS_Result($shares);
239
		} catch (\Exception $e) {