File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,9 @@ export const useAllPointHistoryExcel = () => {
197197 async ( ) =>
198198 await instance . get ( `${ router } /history/excel` , {
199199 responseType : 'blob' ,
200+ headers : {
201+ Accept : 'application/octet-stream' ,
202+ } ,
200203 } ) ,
201204 {
202205 onSuccess : ( res ) => {
Original file line number Diff line number Diff line change 11export const getFileNameFromContentDisposition = ( encodedText : string ) => {
2- let decodedText = decodeURI ( encodedText ) ;
3- decodedText = decodedText . replace ( ' ' , '' ) ;
4- decodedText = decodedText . replace ( 'attachment;filename=' , '' ) ;
5- return decodedText ;
2+ const decoded = decodeURI ( encodedText || '' ) ;
3+ const match = decoded . match ( / f i l e n a m e [ ^ ; = \n ] * = ( ( [ ' " ] ) .* ?\2| [ ^ ; \n ] * ) / ) ;
4+
5+ if ( match && match [ 1 ] ) {
6+ return match [ 1 ] . replace ( / [ ' " ] / g, '' ) . trim ( ) ;
7+ }
8+ return 'download.xlsx' ; // fallback
69} ;
You can’t perform that action at this time.
0 commit comments