query config line break miss bugfix . (#4688)

This commit is contained in:
nov.lzf 2021-01-13 19:35:16 +08:00 committed by GitHub
parent b6255c29ba
commit 79b39db5ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -192,4 +192,7 @@ public class Constants {
public static final String COLON = ":";
public static final String LINE_BREAK = "\n";
}

View File

@ -50,6 +50,7 @@ import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import static com.alibaba.nacos.api.common.Constants.LINE_BREAK;
import static com.alibaba.nacos.config.server.utils.LogUtil.PULL_LOG;
import static com.alibaba.nacos.config.server.utils.RequestUtil.CLIENT_APPNAME_HEADER;
@ -269,7 +270,10 @@ public class ConfigQueryRequestHandler extends RequestHandler<ConfigQueryRequest
reader = new BufferedReader(isr);
String tempStr;
while ((tempStr = reader.readLine()) != null) {
sbf.append(tempStr);
sbf.append(tempStr).append(LINE_BREAK);
}
if (sbf.indexOf(LINE_BREAK) > 0) {
sbf.setLength(sbf.length() - 1);
}
reader.close();
return sbf.toString();