mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Warn user if a comma is present in an extension regex
This commit is contained in:
parent
a2179d2909
commit
d8f04fce98
@ -37,6 +37,8 @@ FilesSetPanel.ingest.createNewFilter=Create/edit file ingest filters...
|
||||
FilesSetPanel.ingest.messages.filtersMustBeNamed=File ingest filters must be named.
|
||||
FilesSetPanel.rule.title=File Filter Rule
|
||||
FilesSetRulePanel.bytes=Bytes
|
||||
#{0} - regex
|
||||
FilesSetRulePanel.CommaInRegexWarning=Warning: Comma(s) in the file extension field will be interpreted as part of a regex and will not split the entry into multiple extensions (Entered: "{0}")
|
||||
FilesSetRulePanel.DaysIncludedEmptyError=Number of days included cannot be empty.
|
||||
FilesSetRulePanel.DaysIncludedInvalidError=Number of days included must be a positive integer.
|
||||
FilesSetRulePanel.gigaBytes=Gigabytes
|
||||
|
@ -57,7 +57,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
"FilesSetRulePanel.NoPathError=Path cannot be empty",
|
||||
"FilesSetRulePanel.DaysIncludedEmptyError=Number of days included cannot be empty.",
|
||||
"FilesSetRulePanel.DaysIncludedInvalidError=Number of days included must be a positive integer.",
|
||||
"FilesSetRulePanel.ZeroFileSizeError=File size condition value must not be 0 (Unless = is selected)."
|
||||
"FilesSetRulePanel.ZeroFileSizeError=File size condition value must not be 0 (Unless = is selected).",
|
||||
"#{0} - regex",
|
||||
"FilesSetRulePanel.CommaInRegexWarning=Warning: Comma(s) in the file extension field will be interpreted as part of a regex and will not split the entry into multiple extensions (Entered: \"{0}\")",
|
||||
})
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -358,6 +360,16 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
|
||||
return false;
|
||||
}
|
||||
if (this.nameRegexCheckbox.isSelected()) {
|
||||
|
||||
// If extension is also selected and the regex contains a comma, display a warning
|
||||
// since it is unclear whether the comma is part of a regex or is separating extensions.
|
||||
if (this.extensionRadioButton.isSelected() && this.nameTextField.getText().contains(",")) {
|
||||
NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
|
||||
Bundle.FilesSetRulePanel_CommaInRegexWarning(this.nameTextField.getText()),
|
||||
NotifyDescriptor.WARNING_MESSAGE);
|
||||
DialogDisplayer.getDefault().notify(notifyDesc);
|
||||
}
|
||||
|
||||
try {
|
||||
Pattern.compile(this.nameTextField.getText());
|
||||
} catch (PatternSyntaxException ex) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user