This should fix it:
https://github.com/discourse/discourse/commit/ec21a15fa7234b8274b5b137afdd6dff78cf52a9