I was copying the wp_ext2type call in wp-includes/post.php, line 4413. I think pathinfo is much more readable, though.