I would check wether the request file as a directory before going into this mode