Added support for detecting filetypes with ambiguous extensions in a similar manner to handling of input from stdin