Skip to content

Commit 045a53e

Browse files
committed
Fixed empty input for excludes regex
1 parent c3fdd60 commit 045a53e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Main/Translation/IContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal class DeepLContext : IContext
1919
private readonly ILogger _logger;
2020
private readonly Func<string, FileInfo> _fileInfoFactory;
2121
private readonly Func<string, DirectoryInfo> _directoryInfoFactory;
22-
private readonly Regex _excludesRegex;
22+
private readonly Regex? _excludesRegex;
2323

2424
public DeepLContext(
2525
IActionInputs actionInputs,
@@ -35,7 +35,7 @@ public DeepLContext(
3535
_fileInfoFactory = fileInfoFactory;
3636
_directoryInfoFactory = directoryInfoFactory;
3737

38-
_excludesRegex = regexFactory(actionInputs.ExcludesRegex);
38+
_excludesRegex = string.IsNullOrWhiteSpace(actionInputs.ExcludesRegex) ? null : regexFactory(actionInputs.ExcludesRegex) ;
3939
}
4040

4141
public async Task TraverseAndTranslate()
@@ -70,7 +70,7 @@ bool IsDefaultResxFileName(FileInfo fi)
7070
}
7171
bool IsNotExcluded(FileInfo defaultResXFile)
7272
{
73-
var ret = !_excludesRegex.IsMatch(defaultResXFile.Name);
73+
var ret = !(_excludesRegex?.IsMatch(defaultResXFile.Name) ?? false);
7474
if(ret) _logger.Notice(defaultResXFile, "Default file excluded by regex");
7575
return ret;
7676
}

0 commit comments

Comments
 (0)