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