Code Duplication    Length = 13-13 lines in 2 locations

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

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