diff --git a/main.cpp b/main.cpp index 5014806..e429054 100644 --- a/main.cpp +++ b/main.cpp @@ -248,8 +248,7 @@ int main() if(!api_mode) readConf(); std::string surge_base_content; - std::string url = UrlDecode(getUrlArg(argument, "url")), include = UrlDecode(getUrlArg(argument, "regex")), group = UrlDecode(getUrlArg(argument, "group")); - int surge_ver = stoi(getUrlArg(argument, "ver")); + std::string url = UrlDecode(getUrlArg(argument, "url")), include = UrlDecode(getUrlArg(argument, "regex")), group = UrlDecode(getUrlArg(argument, "group")), version = getUrlArg(argument, "ver"); int surge_ver = version.size() ? stoi(version) : 3; if(!url.size()) url = default_url; string_array urls = split(url, "|"); std::vector nodes; diff --git a/misc.cpp b/misc.cpp index c8a6fd1..bdd2a04 100644 --- a/misc.cpp +++ b/misc.cpp @@ -128,7 +128,8 @@ std::string UrlDecode(const std::string& str) strTemp += ' '; else if (str[i] == '%') { - assert(i + 2 < length); + if(i + 2 < length) + return strTemp; unsigned char high = FromHex((unsigned char)str[++i]); unsigned char low = FromHex((unsigned char)str[++i]); strTemp += high * 16 + low; diff --git a/subexport.cpp b/subexport.cpp index 5797d4c..460f38e 100644 --- a/subexport.cpp +++ b/subexport.cpp @@ -267,7 +267,7 @@ void rulesetToSurge(INIReader &base_rule, string_array &ruleset_array, int surge } else { - allRules.emplace_back("RULESET," + rule_path + "," + rule_group); + allRules.emplace_back("RULE-SET," + rule_path + "," + rule_group); } } }