MCPcopy Create free account
hub / github.com/pillarjs/multiparty / parseFilename

Function parseFilename

index.js:837–854  ·  view source on GitHub ↗
(headerValue)

Source from the content-addressed store, hash-verified

835}
836
837function parseFilename(headerValue) {
838 var m = FILENAME_PARAM_RE.exec(headerValue)
839 if (!m) {
840 m = headerValue.match(/;[ \t]*filename\*=utf-8''([^;]*)/i)
841 if (m) {
842 m[1] = tryDecode(m[1]);
843 } else {
844 return;
845 }
846 }
847
848 var filename = m[1] || m[2] || '';
849 filename = filename.replace(/%22|\\"/g, '"');
850 filename = filename.replace(/&#([0-9]{1,5});/g, function(m, code) {
851 return String.fromCharCode(code);
852 });
853 return filename.substr(filename.lastIndexOf('\\') + 1);
854}
855
856function lower(c) {
857 return c | 0x20;

Callers 1

index.jsFile · 0.85

Calls 1

tryDecodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…