fixed removal of trailing slash is not enough. (refs #3658, BP from #1632)
Merge remote-tracking branch 'ama/t-3658' into stable-3.6.x