Skip to content

Commit

Permalink
Fixed name error
Browse files Browse the repository at this point in the history
  • Loading branch information
jLynx committed Jan 11, 2024
1 parent c4484de commit c2a662d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/components/Controller/Controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,16 @@ const Controller = () => {
throw new Error("Network response was not ok");
}

console.log(response.headers);

const contentDispositionHeader = response.headers.get(
"Content-Disposition"
);
console.log(contentDispositionHeader);
const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
let matches = contentDispositionHeader?.match(filenameRegex);
let filename = matches && matches[1] ? matches[1] : "unknown";
let filename =
matches && matches[1] ? matches[1].replace(/['"]/g, "") : "unknown";

const blob = await response.blob();

Expand Down

0 comments on commit c2a662d

Please sign in to comment.