mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
fix(download): properly parse content-disposition filename (#6159)
This commit is contained in:
parent
637f647cc7
commit
4c85e3d2ac
38
packages/insomnia/package-lock.json
generated
38
packages/insomnia/package-lock.json
generated
@ -28,6 +28,7 @@
|
||||
"change-case": "^4.1.2",
|
||||
"clone": "^2.1.0",
|
||||
"color": "^3.1.2",
|
||||
"content-disposition": "^0.5.4",
|
||||
"dompurify": "^3.0.5",
|
||||
"electron-context-menu": "^3.6.1",
|
||||
"electron-log": "^4.4.8",
|
||||
@ -73,6 +74,7 @@
|
||||
"@types/clone": "^2.1.0",
|
||||
"@types/codemirror": "^5.60.2",
|
||||
"@types/color": "^3.0.1",
|
||||
"@types/content-disposition": "^0.5.5",
|
||||
"@types/deep-equal": "^1.0.1",
|
||||
"@types/dompurify": "^2.3.3",
|
||||
"@types/hawk": "9.0.2",
|
||||
@ -5952,6 +5954,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/content-disposition": {
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.5.tgz",
|
||||
"integrity": "sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/crypto-js": {
|
||||
"version": "4.0.1",
|
||||
"dev": true,
|
||||
@ -8315,6 +8323,36 @@
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz",
|
||||
"integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA=="
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition/node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/convert-source-map": {
|
||||
"version": "1.7.0",
|
||||
"license": "MIT",
|
||||
|
@ -59,6 +59,7 @@
|
||||
"change-case": "^4.1.2",
|
||||
"clone": "^2.1.0",
|
||||
"color": "^3.1.2",
|
||||
"content-disposition": "^0.5.4",
|
||||
"dompurify": "^3.0.5",
|
||||
"electron-context-menu": "^3.6.1",
|
||||
"electron-log": "^4.4.8",
|
||||
@ -122,6 +123,7 @@
|
||||
"@types/clone": "^2.1.0",
|
||||
"@types/codemirror": "^5.60.2",
|
||||
"@types/color": "^3.0.1",
|
||||
"@types/content-disposition": "^0.5.5",
|
||||
"@types/deep-equal": "^1.0.1",
|
||||
"@types/dompurify": "^2.3.3",
|
||||
"@types/hawk": "9.0.2",
|
||||
|
@ -1,3 +1,4 @@
|
||||
import * as contentDisposition from 'content-disposition';
|
||||
import type { SaveDialogOptions } from 'electron';
|
||||
import fs from 'fs';
|
||||
import { extension as mimeExtension } from 'mime-types';
|
||||
@ -125,7 +126,7 @@ export const RequestUrlBar = forwardRef<RequestUrlBarHandle, Props>(({
|
||||
const responsePatch = await network.send(request._id, activeEnvironment?._id);
|
||||
const headers = responsePatch.headers || [];
|
||||
const header = getContentDispositionHeader(headers);
|
||||
const nameFromHeader = header ? header.value : null;
|
||||
const nameFromHeader = header ? contentDisposition.parse(header.value).parameters.filename : null;
|
||||
|
||||
if (
|
||||
responsePatch.bodyPath &&
|
||||
|
Loading…
Reference in New Issue
Block a user