mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[bugfix] prevent bug with special chars when using "preferContentDisposition"
This commit is contained in:
@@ -8,6 +8,7 @@ import { unlinkSync } from "fs-extra";
|
||||
import { tryit } from "shared/helpers/error.helpers";
|
||||
import path from "path";
|
||||
import { pipeline } from "stream/promises";
|
||||
import sanitize from "sanitize-filename";
|
||||
|
||||
export class RequestService {
|
||||
private static instance: RequestService;
|
||||
@@ -66,7 +67,7 @@ export class RequestService {
|
||||
const filename = opt?.preferContentDisposition ? this.getFilenameFromContentDisposition(response.headers["content-disposition"]) : null;
|
||||
|
||||
if (filename) {
|
||||
dest = path.join(path.dirname(dest), filename);
|
||||
dest = path.join(path.dirname(dest), sanitize(filename));
|
||||
}
|
||||
|
||||
progress.data = dest;
|
||||
|
||||
Reference in New Issue
Block a user