dovecot-1.1: fts-solr: Solr breaks when it sees control characte...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Mar 23 22:33:16 EET 2009
details: http://hg.dovecot.org/dovecot-1.1/rev/678c3252a454
changeset: 8216:678c3252a454
user: Timo Sirainen <tss at iki.fi>
date: Mon Mar 23 16:33:11 2009 -0400
description:
fts-solr: Solr breaks when it sees control characters, so replace them with spaces.
diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
src/plugins/fts-solr/fts-backend-solr.c | 14 +++++++++++++-
diffs (25 lines):
diff -r 7d940dd2986e -r 678c3252a454 src/plugins/fts-solr/fts-backend-solr.c
--- a/src/plugins/fts-solr/fts-backend-solr.c Mon Mar 23 12:50:16 2009 -0400
+++ b/src/plugins/fts-solr/fts-backend-solr.c Mon Mar 23 16:33:11 2009 -0400
@@ -43,8 +43,20 @@ xml_encode_data(string_t *dest, const un
case '>':
str_append(dest, ">");
break;
+ case '\t':
+ case '\n':
+ case '\r':
+ /* exceptions to the following control char check */
+ str_append_c(dest, data[i]);
+ break;
default:
- str_append_c(dest, data[i]);
+ if (data[i] < 32) {
+ /* SOLR doesn't like control characters.
+ replace them with spaces. */
+ str_append_c(dest, ' ');
+ } else {
+ str_append_c(dest, data[i]);
+ }
break;
}
}
More information about the dovecot-cvs
mailing list