Added a trim to the publisher_code.

Added a trim command to the publisher code. Once the following issue has been ironed out, this won't be needed.

https://github.com/discourse/discourse/pull/2181