Nice repro @simon!
This fixes it:
https://github.com/discourse/discourse/commit/a73da42691734d8afddb4a255969c934da6d4ad9