I fixed this:
https://github.com/discourse/discourse/commit/66423e62dceabbb9f688569e02e5a91e3bb0201c
It will raise other edge cases, but lets live with it and see who complains