Code Duplication    Length = 13-13 lines in 2 locations

apps/files_sharing/lib/Controller/Share20OcsController.php 2 locations

@@ 424-436 (lines=13) @@
421
			// legacy way, expecting that this won't be used together with "create-only" shares
422
			$publicUpload = $this->request->getParam('publicUpload', null);
423
			// a few permission checks
424
			if ($publicUpload === 'true' || $permissions === \OCP\Constants::PERMISSION_CREATE) {
425
				// Check if public upload is allowed
426
				if (!$this->shareManager->shareApiLinkAllowPublicUpload()) {
427
					$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
428
					return new \OC\OCS\Result(null, 403, $this->l->t('Public upload disabled by the administrator'));
429
				}
430
431
				// Public upload can only be set for folders
432
				if ($path instanceof \OCP\Files\File) {
433
					$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
434
					return new \OC\OCS\Result(null, 404, $this->l->t('Public upload is only possible for publicly shared folders'));
435
				}
436
			}
437
438
			// convert to permissions
439
			if ($publicUpload === 'true') {
@@ 764-776 (lines=13) @@
761
			}
762
763
			// create-only (upload-only)
764
			if (
765
				$newPermissions === \OCP\Constants::PERMISSION_CREATE
766
			) {
767
				if (!$this->shareManager->shareApiLinkAllowPublicUpload()) {
768
					$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
769
					return new \OC\OCS\Result(null, 403, $this->l->t('Public upload disabled by the administrator'));
770
				}
771
772
				if (!($share->getNode() instanceof \OCP\Files\Folder)) {
773
					$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
774
					return new \OC\OCS\Result(null, 400, $this->l->t('Public upload is only possible for publicly shared folders'));
775
				}
776
			}
777
778
			// set name only if passed as parameter, empty string is allowed
779
			if ($name !== null) {