Skip to content

Commit

Permalink
trim id 并阻止 . 特殊符号 resolved #506
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Sep 20, 2024
1 parent 669e215 commit db18165
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,12 @@ public RuleSubInfoEntity getRuleSubInfo(String ruleId) throws SQLException {
*/
public ConfigurationSection saveRuleSubInfo(@NotNull RuleSubInfoEntity ruleSubInfo) throws IOException {
ConfigurationSection rules = getRuleSubsConfig();
String ruleId = ruleSubInfo.getRuleId();
String ruleId = ruleSubInfo.getRuleId().trim();
if(ruleId.contains(".")){
throw new IllegalArgumentException("Character '.' is not allowed.");
}
rules.set(ruleId + ".enabled", ruleSubInfo.isEnabled());
rules.set(ruleId + ".name", ruleSubInfo.getRuleName());
rules.set(ruleId + ".name", ruleSubInfo.getRuleName().trim());
rules.set(ruleId + ".url", ruleSubInfo.getSubUrl());
saveConfig();
return rules.getConfigurationSection(ruleId);
Expand Down

0 comments on commit db18165

Please sign in to comment.