Code Duplication    Length = 6-8 lines in 2 locations

lib/private/Share/Share.php 2 locations

@@ 763-768 (lines=6) @@
760
					}
761
				}
762
763
				if (\OCP\Util::isPublicLinkPasswordRequired() && empty($shareWith)) {
764
					$message = 'You need to provide a password to create a public link, only protected links are allowed';
765
					$message_t = $l->t('You need to provide a password to create a public link, only protected links are allowed');
766
					\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::DEBUG);
767
					throw new \Exception($message_t);
768
				}
769
770
				if ($updateExistingShare === false &&
771
					self::isDefaultExpireDateEnabled() &&
@@ 1268-1275 (lines=8) @@
1265
		$l = \OC::$server->getL10N('lib');
1266
1267
		if ($date == '') {
1268
			if (\OCP\Util::isDefaultExpireDateEnforced()) {
1269
				$warning = 'Cannot clear expiration date. Shares are required to have an expiration date.';
1270
				$warning_t = $l->t('Cannot clear expiration date. Shares are required to have an expiration date.');
1271
				\OCP\Util::writeLog('OCP\Share', $warning, \OCP\Util::WARN);
1272
				throw new \Exception($warning_t);
1273
			} else {
1274
				$date = null;
1275
			}
1276
		} else {
1277
			$date = self::validateExpireDate($date, $shareTime, $itemType, $itemSource);
1278
		}