fix: file name bug
+ Addressed issue where file names were not being properly parsed from the response headers. + Updated tests to ensure that the file name is properly parsed from the response headers.
This commit is contained in:
@@ -261,13 +261,10 @@ export class ApiResponse<T> {
|
||||
|
||||
public asFileType(response: AxiosResponse): ApiResponse<File> {
|
||||
const apiResponse = this as ApiResponse<any>;
|
||||
|
||||
let fileName = response.headers['content-disposition']
|
||||
const fileName = response.headers['content-disposition']
|
||||
.split(';')[1]
|
||||
.split('=')[1];
|
||||
|
||||
fileName = fileName.substring(1, fileName.length - 1);
|
||||
|
||||
const contentType =
|
||||
response.headers['content-type'] ??
|
||||
response.headers['Content-Type'] ??
|
||||
|
||||
Reference in New Issue
Block a user