File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -206,13 +206,13 @@ export const getFilenameFromResponse = (response: Response): string => {
206206 const contentDisposition = response . headers . get ( 'Content-Disposition' )
207207 // Try to extract UTF-8 filename first
208208 const utf8Filename = contentDisposition ?. match ( / f i l e n a m e \* = u t f - 8 ' .* ' ( .* ?) (?: ; | $ ) / i)
209- if ( utf8Filename ?. [ 1 ] !== '' ) {
210- return decodeURIComponent ( utf8Filename ! [ 1 ] )
209+ if ( utf8Filename ?. [ 1 ] && utf8Filename [ 1 ] . length > 0 ) {
210+ return decodeURIComponent ( utf8Filename [ 1 ] )
211211 }
212212 // Fallback to regular filename
213213 const filename = contentDisposition ?. match ( / f i l e n a m e = " ? ( .* ?) (?: " | ; | $ ) / i)
214- if ( filename ?. [ 1 ] !== '' ) {
215- return filename ! [ 1 ]
214+ if ( filename ?. [ 1 ] && filename [ 1 ] . length > 0 ) {
215+ return filename [ 1 ]
216216 }
217217 // Fallback to URL path
218218 const url = new URL ( response . url )
You can’t perform that action at this time.
0 commit comments