From 09bb2909d071623b4f53e5301916bf5f8b6d8c7a Mon Sep 17 00:00:00 2001 From: Mi Tom Date: Tue, 3 Oct 2023 18:24:32 +0800 Subject: [PATCH] Fix client parse errors with '=' in remark strings (#632) Replace every '=' with '-' in the remark string to avoid parse errors from the clients. --- src/generator/config/subexport.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/generator/config/subexport.cpp b/src/generator/config/subexport.cpp index dbeff7f..59d4413 100644 --- a/src/generator/config/subexport.cpp +++ b/src/generator/config/subexport.cpp @@ -157,6 +157,11 @@ bool applyMatcher(const std::string &rule, std::string &real_rule, const Proxy & void processRemark(std::string &oldremark, std::string &newremark, string_array &remarks_list, bool proc_comma = true) { + // Replace every '=' with '-' in the remark string to avoid parse errors from the clients. + // Surge is tested to yield an error when handling '=' in the remark string, + // not sure if other clients have the same problem. + std::replace(oldremark.begin(), oldremark.end(), '=', '-'); + if(proc_comma) { if(oldremark.find(',') != std::string::npos)