MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / filename

Method filename

thirdparty/bottle/bottle.py:3148–3165  ·  view source on GitHub ↗

Name of the file on the client file system, but normalized to ensure file system compatibility. An empty filename is returned as 'empty'. Only ASCII letters, digits, dashes, underscores and dots are allowed in the final filename. Accents are removed, if possible

(self)

Source from the content-addressed store, hash-verified

3146
3147 @cached_property
3148 def filename(self):
3149 """ Name of the file on the client file system, but normalized to ensure
3150 file system compatibility. An empty filename is returned as 'empty'.
3151
3152 Only ASCII letters, digits, dashes, underscores and dots are
3153 allowed in the final filename. Accents are removed, if possible.
3154 Whitespace is replaced by a single dash. Leading or tailing dots
3155 or dashes are removed. The filename is limited to 255 characters.
3156 """
3157 fname = self.raw_filename
3158 if not isinstance(fname, unicode):
3159 fname = fname.decode('utf8', 'ignore')
3160 fname = normalize('NFKD', fname)
3161 fname = fname.encode('ASCII', 'ignore').decode('ASCII')
3162 fname = os.path.basename(fname.replace('\\', os.path.sep))
3163 fname = re.sub(r'[^a-zA-Z0-9-_.\s]', '', fname).strip()
3164 fname = re.sub(r'[-\s]+', '-', fname).strip('.-')
3165 return fname[:255] or 'empty'
3166
3167 def _copy_file(self, fp, chunk_size=2 ** 16):
3168 read, write, offset = self.file.read, fp.write, self.file.tell()

Callers

nothing calls this directly

Calls 2

decodeMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected