Removed leading/trailing whitespace for filter. Fixed related whitespace bug & added test; Redmine#469