core: use lower case extensions when guessing mime or file extension.

(cherry picked from commit 4ae2967ef66b7b96437a3e445752e18b0597802d)