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