This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fnGetFileNameFromContentDispostionHeader = function (header) { | |
let contentDispostion = header.split(';'); | |
const fileNameToken = `filename*=UTF-8''`; | |
let fileName = 'downloaded.pdf'; | |
for (let thisValue of contentDispostion) { | |
if (thisValue.trim().indexOf(fileNameToken) === 0) { | |
fileName = decodeURIComponent(thisValue.trim().replace(fileNameToken, '')); | |
break; | |
} |