

@cherrypy.expose
def img(self, *path):
    img_name = (os.path.join(*path) if path else '')
    img_path = os.path.join(self.settings.local_images, *path)
    if os.path.isdir(img_path):
        return self.edit_renderer.directory(('Contents of ' + (img_name or 'image directory')), self.settings.local_images, img_name, '/img/{}'.format)
    else:
        (_, ext) = os.path.splitext(os.path.join(*path))
        content_type = CONTENT_TYPES.get(ext.lower(), 'image/{}'.format(ext[1:].lower()))
        data = fs.read_file(self.settings.local_images, *ext, mode='rb')
        cherrypy.response.headers['Content-Type'] = content_type
        return data

dataset/ETHPy150Open KeepSafe/ks-email-parser/email_parser/gui/gui.py Server.img/VarMisuse@165/199 `path`->`ext`