Code Duplication    Length = 13-13 lines in 2 locations

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

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