Code Duplication    Length = 5-7 lines in 2 locations

apps/files_sharing/lib/Controllers/ShareController.php 1 location

@@ 480-486 (lines=7) @@
477
		 * the content must not be longer than 32 characters and must only contain
478
		 * alphanumeric characters
479
		 */
480
		if (!empty($downloadStartSecret)
481
			&& !isset($downloadStartSecret[32])
482
			&& preg_match('!^[a-zA-Z0-9]+$!', $downloadStartSecret) === 1) {
483
484
			// FIXME: set on the response once we use an actual app framework response
485
			setcookie('ocDownloadStarted', $downloadStartSecret, time() + 20, '/');
486
		}
487
488
		$this->emitAccessShareHook($share);
489

apps/dav/lib/Connector/Sabre/FilesPlugin.php 1 location

@@ 217-221 (lines=5) @@
214
		 */
215
		if (isset($queryParams['downloadStartSecret'])) {
216
			$token = $queryParams['downloadStartSecret'];
217
			if (!isset($token[32])
218
				&& preg_match('!^[a-zA-Z0-9]+$!', $token) === 1) {
219
				// FIXME: use $response->setHeader() instead
220
				setcookie('ocDownloadStarted', $token, time() + 20, '/');
221
			}
222
		}
223
	}
224