From 29658a7966949c5c53c9a52e592d2888b29a149b Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 12 Apr 2021 09:17:44 +0800 Subject: [PATCH] fix: relative path for submodule is optional. --- src/Helpers/Validations.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Helpers/Validations.cs b/src/Helpers/Validations.cs index 3fb2deb2..5a1b7d36 100644 --- a/src/Helpers/Validations.cs +++ b/src/Helpers/Validations.cs @@ -130,9 +130,11 @@ namespace SourceGit.Helpers { /// public class SubmodulePathRequiredRule : ValidationRule { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { - var regex = new Regex(@"^[\w\-\._/]+$"); var path = value as string; - var succ = !string.IsNullOrEmpty(path) && regex.IsMatch(path.Trim()); + if (string.IsNullOrEmpty(path)) return ValidationResult.ValidResult; + + var regex = new Regex(@"^[\w\-\._/]+$"); + var succ = regex.IsMatch(path.Trim()); return !succ ? new ValidationResult(false, App.Text("BadSubmodulePath")) : ValidationResult.ValidResult; } }