Code Duplication    Length = 5-7 lines in 2 locations

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

@@ 210-214 (lines=5) @@
207
		 */
208
		if (isset($queryParams['downloadStartSecret'])) {
209
			$token = $queryParams['downloadStartSecret'];
210
			if (!isset($token[32])
211
				&& preg_match('!^[a-zA-Z0-9]+$!', $token) === 1) {
212
				// FIXME: use $response->setHeader() instead
213
				setcookie('ocDownloadStarted', $token, time() + 20, '/');
214
			}
215
		}
216
	}
217

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

@@ 494-500 (lines=7) @@
491
		 * the content must not be longer than 32 characters and must only contain
492
		 * alphanumeric characters
493
		 */
494
		if (!empty($downloadStartSecret)
495
			&& !isset($downloadStartSecret[32])
496
			&& preg_match('!^[a-zA-Z0-9]+$!', $downloadStartSecret) === 1) {
497
498
			// FIXME: set on the response once we use an actual app framework response
499
			setcookie('ocDownloadStarted', $downloadStartSecret, time() + 20, '/');
500
		}
501
502
		$this->emitAccessShareHook($share);
503