Code Duplication    Length = 5-7 lines in 2 locations

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

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

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

@@ 507-513 (lines=7) @@
504
		 * the content must not be longer than 32 characters and must only contain
505
		 * alphanumeric characters
506
		 */
507
		if (!empty($downloadStartSecret)
508
			&& !isset($downloadStartSecret[32])
509
			&& \preg_match('!^[a-zA-Z0-9]+$!', $downloadStartSecret) === 1) {
510
511
			// FIXME: set on the response once we use an actual app framework response
512
			\setcookie('ocDownloadStarted', $downloadStartSecret, \time() + 20, '/');
513
		}
514
515
		$this->emitAccessShareHook($share);
516