Code Duplication    Length = 6-8 lines in 2 locations

lib/private/share/share.php 2 locations

@@ 805-810 (lines=6) @@
802
					}
803
				}
804
805
				if (\OCP\Util::isPublicLinkPasswordRequired() && empty($shareWith)) {
806
					$message = 'You need to provide a password to create a public link, only protected links are allowed';
807
					$message_t = $l->t('You need to provide a password to create a public link, only protected links are allowed');
808
					\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::DEBUG);
809
					throw new \Exception($message_t);
810
				}
811
812
				if ($updateExistingShare === false &&
813
					self::isDefaultExpireDateEnabled() &&
@@ 1251-1258 (lines=8) @@
1248
		$l = \OC::$server->getL10N('lib');
1249
1250
		if ($date == '') {
1251
			if (\OCP\Util::isDefaultExpireDateEnforced()) {
1252
				$warning = 'Cannot clear expiration date. Shares are required to have an expiration date.';
1253
				$warning_t = $l->t('Cannot clear expiration date. Shares are required to have an expiration date.');
1254
				\OCP\Util::writeLog('OCP\Share', $warning, \OCP\Util::WARN);
1255
				throw new \Exception($warning_t);
1256
			} else {
1257
				$date = null;
1258
			}
1259
		} else {
1260
			$date = self::validateExpireDate($date, $shareTime, $itemType, $itemSource);
1261
		}