don't downcase a Pathname object

Fixes #3572.