File extension missed and wrong filename for remote url

I have image url without extention, and it isn't saved.
My fast hook for this bug.
Works only for images files.