Fix extension detection when in tmp dir