@classmethod
    def filter_filename(cls, filename, storage_name, content_type, content_type_hint):
        # Make up filename if we don't have one
        if not filename:
            if not content_type:
                content_type = content_type_hint
            # note: stdlib mimetypes.guess_extension is total crap
            if content_type.startswith("text/"):
                ext = ".txt"
            else:
                ext = ".bin"
            filename = storage_name + ext
        return cls._filename_re.sub('', filename)[:MAX_FILENAME_LENGTH]
Filter filename.
dataset/ETHPy150Open bepasty/bepasty-server/bepasty/utils/upload.py/Upload.filter_filename