Code Duplication    Length = 5-7 lines in 2 locations

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

@@ 236-240 (lines=5) @@
233
		 */
234
		if (isset($queryParams['downloadStartSecret'])) {
235
			$token = $queryParams['downloadStartSecret'];
236
			if (!isset($token[32])
237
				&& preg_match('!^[a-zA-Z0-9]+$!', $token) === 1) {
238
				// FIXME: use $response->setHeader() instead
239
				setcookie('ocDownloadStarted', $token, time() + 20, '/');
240
			}
241
		}
242
	}
243

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

@@ 545-551 (lines=7) @@
542
		 * the content must not be longer than 32 characters and must only contain
543
		 * alphanumeric characters
544
		 */
545
		if (!empty($downloadStartSecret)
546
			&& !isset($downloadStartSecret[32])
547
			&& preg_match('!^[a-zA-Z0-9]+$!', $downloadStartSecret) === 1) {
548
549
			// FIXME: set on the response once we use an actual app framework response
550
			setcookie('ocDownloadStarted', $downloadStartSecret, time() + 20, '/');
551
		}
552
553
		$this->emitAccessShareHook($share);
554