Thank you for reporting this bug. It is fixed with this PR:
https://github.com/discourse/discourse/pull/19254