fix post quote for null extra texts.

refactor-toolbar
Floens 8 years ago
parent 4a9b0b42bc
commit fbe777d0cd
  1. 16
      Clover/app/src/main/java/org/floens/chan/core/presenter/ReplyPresenter.java

@ -299,13 +299,15 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe
String postQuote = post != null ? ">>" + post.no + "\n" : ""; String postQuote = post != null ? ">>" + post.no + "\n" : "";
StringBuilder textQuoteResult = new StringBuilder(); StringBuilder textQuoteResult = new StringBuilder();
String[] lines = textQuote.split("\n+"); if (textQuote != null) {
// matches for >>123, >>123 (OP), >>123 (You), >>>/fit/123 String[] lines = textQuote.split("\n+");
final Pattern quotePattern = Pattern.compile("^>>(>/[a-z0-9]+/)?\\d+.*$"); // matches for >>123, >>123 (OP), >>123 (You), >>>/fit/123
for (String line : lines) { final Pattern quotePattern = Pattern.compile("^>>(>/[a-z0-9]+/)?\\d+.*$");
// do not include post no from quoted post for (String line : lines) {
if (!quotePattern.matcher(line).matches()) { // do not include post no from quoted post
textQuoteResult.append(">").append(line).append("\n"); if (!quotePattern.matcher(line).matches()) {
textQuoteResult.append(">").append(line).append("\n");
}
} }
} }

Loading…
Cancel
Save