This should be fixed per:
https://github.com/discourse/discourse/commit/a74ac90bf520db21cb8a8d2ddd04494cc174ad4c
This is a bit of a multibug you posted here, so I am closing this, but feel free to open up another report on other edge cases after you apply the fix.