Fixes #27547

Comment From: snicoll

@lower-case thank you for your contribution. I've polished it in 68a47a7.