mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-60683 GitHub integration: Share project on GitHub: multiline comment is not supported
This commit is contained in:
@@ -482,11 +482,12 @@ public class JDOMUtil {
|
||||
* Returns null if no escapement necessary.
|
||||
*/
|
||||
@Nullable
|
||||
private static String escapeChar(char c, boolean escapeLineEnds) {
|
||||
private static String escapeChar(char c, boolean escapeSpaces, boolean escapeLineEnds) {
|
||||
switch (c) {
|
||||
case '\n': return escapeLineEnds ? " " : null;
|
||||
case '\r': return escapeLineEnds ? " " : null;
|
||||
case '\t': return escapeLineEnds ? "	" : null;
|
||||
case ' ' : return escapeSpaces ? "" : null;
|
||||
case '<': return "<";
|
||||
case '>': return ">";
|
||||
case '\"': return """;
|
||||
@@ -497,15 +498,15 @@ public class JDOMUtil {
|
||||
|
||||
@NotNull
|
||||
public static String escapeText(String text) {
|
||||
return escapeText(text, false);
|
||||
return escapeText(text, false, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String escapeText(String text, boolean escapeLineEnds) {
|
||||
public static String escapeText(String text, boolean escapeSpaces, boolean escapeLineEnds) {
|
||||
StringBuffer buffer = null;
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
final char ch = text.charAt(i);
|
||||
final String quotation = escapeChar(ch, escapeLineEnds);
|
||||
final String quotation = escapeChar(ch, escapeSpaces, escapeLineEnds);
|
||||
|
||||
if (buffer == null) {
|
||||
if (quotation != null) {
|
||||
@@ -548,11 +549,11 @@ public class JDOMUtil {
|
||||
|
||||
public static class MyXMLOutputter extends XMLOutputter {
|
||||
public String escapeAttributeEntities(String str) {
|
||||
return escapeText(str, true);
|
||||
return escapeText(str, false, true);
|
||||
}
|
||||
|
||||
public String escapeElementEntities(String str) {
|
||||
return escapeText(str, false);
|
||||
return escapeText(str, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class GithubUtil {
|
||||
public static HttpMethod doREST(final String login, final String password, final String request, final boolean post) throws Exception {
|
||||
final HttpClient client = getHttpClient(login, password);
|
||||
client.getParams().setContentCharset("UTF-8");
|
||||
final String uri = getUrl() + JDOMUtil.escapeText(request).replaceAll(" ", "%20");
|
||||
final String uri = JDOMUtil.escapeText(getUrl() + request, true, true);
|
||||
final HttpMethod method = post ? new PostMethod(uri) : new GetMethod(uri);
|
||||
client.executeMethod(method);
|
||||
return method;
|
||||
|
||||
Reference in New Issue
Block a user