Code Duplication    Length = 5-7 lines in 2 locations

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

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

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

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