Fix: Do not allow empty Hashtags

Sending a hashtag string to PutHashtags in any of these
formats:

* ","
* ",tag"
* "tag,"
* "tag1,,tag2"

...would create an empty tag which could not be deleted
using the RESTApi.

Change-Id: Ic37a5721de8bfe5846de1a84f6c1c95b96dd9906
This commit is contained in:
Gustaf Lundh 2014-09-11 17:28:03 +02:00
parent 30565e12aa
commit 2970f85486

View File

@ -76,7 +76,7 @@ public class PutHashtags implements RestModifyView<ChangeResource, Input> {
hashtags.addAll(oldHashtags);
};
hashtags.addAll(Lists.newArrayList(Splitter.on(CharMatcher.anyOf(",;"))
.trimResults().split(input.hashtags)));
.trimResults().omitEmptyStrings().split(input.hashtags)));
update.setHashtags(hashtags);
update.commit();
indexer.index(dbProvider.get(), update.getChange());