Does this fix it?
https://github.com/discourse/discourse/commit/bd1ca35f8b91f94de74c827a1656bdfad3fbf015