dovecot-1.2: fts-solr: Solr breaks when it sees control characte...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Mar 23 22:33:29 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/dd441977c578
changeset: 8848:dd441977c578
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 43a49b3d3b5e -r dd441977c578 src/plugins/fts-solr/fts-backend-solr.c
--- a/src/plugins/fts-solr/fts-backend-solr.c Mon Mar 23 12:51:30 2009 -0400
+++ b/src/plugins/fts-solr/fts-backend-solr.c Mon Mar 23 16:33:11 2009 -0400
@@ -64,8 +64,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