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

@@ 520-526 (lines=7) @@
517
		 * the content must not be longer than 32 characters and must only contain
518
		 * alphanumeric characters
519
		 */
520
		if (!empty($downloadStartSecret)
521
			&& !isset($downloadStartSecret[32])
522
			&& preg_match('!^[a-zA-Z0-9]+$!', $downloadStartSecret) === 1) {
523
524
			// FIXME: set on the response once we use an actual app framework response
525
			setcookie('ocDownloadStarted', $downloadStartSecret, time() + 20, '/');
526
		}
527
528
		$this->emitAccessShareHook($share);
529