How to cycle through texture extensions if no extension was given or the given extension is wrong?

I have this model:
https://modelviewer.cgig.ru/model?url=https%3A%2F%2Fcgig.ru%2Fdownloads%2Fmodels%2Fdiablo2_re%2Fcharacters%2Famazon.txt
which is fine except there’s no extension in the texture filenames this FBX is expecting.

the question is how to cycle through texture extensions (DDS/PNG/TGA/JPG) if no extension was given or the given extension is wrong?