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:
Stevan Freeborn
2023-02-21 16:41:06 -06:00
parent 2000a860a4
commit 522efb1f67
3 changed files with 51 additions and 51 deletions
+1 -4
View File
@@ -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'] ??