Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 415-427 (lines=13) @@
412
			// legacy way, expecting that this won't be used together with "create-only" shares
413
			$publicUpload = $this->request->getParam('publicUpload', null);
414
			// a few permission checks
415
			if ($publicUpload === 'true' || $permissions === \OCP\Constants::PERMISSION_CREATE) {
416
				// Check if public upload is allowed
417
				if (!$this->shareManager->shareApiLinkAllowPublicUpload()) {
418
					$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
419
					return new \OC\OCS\Result(null, 403, $this->l->t('Public upload disabled by the administrator'));
420
				}
421
422
				// Public upload can only be set for folders
423
				if ($path instanceof \OCP\Files\File) {
424
					$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
425
					return new \OC\OCS\Result(null, 404, $this->l->t('Public upload is only possible for publicly shared folders'));
426
				}
427
			}
428
429
			// convert to permissions
430
			if ($publicUpload === 'true') {
@@ 749-761 (lines=13) @@
746
			}
747
748
			// create-only (upload-only)
749
			if (
750
				$newPermissions === \OCP\Constants::PERMISSION_CREATE
751
			) {
752
				if (!$this->shareManager->shareApiLinkAllowPublicUpload()) {
753
					$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
754
					return new \OC\OCS\Result(null, 403, $this->l->t('Public upload disabled by the administrator'));
755
				}
756
757
				if (!($share->getNode() instanceof \OCP\Files\Folder)) {
758
					$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
759
					return new \OC\OCS\Result(null, 400, $this->l->t('Public upload is only possible for publicly shared folders'));
760
				}
761
			}
762
763
			// set name only if passed as parameter, empty string is allowed
764
			if ($name !== null) {