chore(deps): mime-types update (and bug fix) (#4582)

This commit is contained in:
Dimitri Mitropoulos 2022-03-20 10:30:13 -05:00 committed by GitHub
parent abea565f83
commit f8e5263bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 53 additions and 53 deletions

View File

@ -1,5 +1,5 @@
import fs from 'fs';
import mimes from 'mime-types';
import { lookup } from 'mime-types';
import path from 'path';
import type { RequestBodyParameter } from '../models/request';
@ -63,7 +63,7 @@ export async function buildMultipart(params: RequestBodyParameter[]) {
if (param.type === 'file' && param.fileName) {
const name = param.name || '';
const fileName = param.fileName;
const contentType = mimes.lookup(fileName) || 'application/octet-stream';
const contentType = lookup(fileName) || 'application/octet-stream';
addString(
'Content-Disposition: form-data; ' +
`name="${name.replace(/"/g, '\\"')}"; ` +

View File

@ -1,7 +1,7 @@
import { autoBindMethodsForReact } from 'class-autobind-decorator';
import clone from 'clone';
import { SvgIcon } from 'insomnia-components';
import * as mimes from 'mime-types';
import { lookup } from 'mime-types';
import React, { PureComponent } from 'react';
import {
@ -92,7 +92,7 @@ export class BodyEditor extends PureComponent<Props> {
// Update Content-Type header if the user wants
const contentType = contentTypeHeader.value;
const newContentType = mimes.lookup(path) || CONTENT_TYPE_FILE;
const newContentType = lookup(path) || CONTENT_TYPE_FILE;
if (contentType !== newContentType && path) {
contentTypeHeader.value = newContentType;

View File

@ -4,7 +4,7 @@ import { clipboard } from 'electron';
import fs from 'fs';
import { HotKeyRegistry } from 'insomnia-common';
import { json as jsonPrettify } from 'insomnia-prettify';
import mime from 'mime-types';
import { extension as mimeExtension } from 'mime-types';
import React, { PureComponent } from 'react';
import { Tab, TabList, TabPanel, Tabs } from 'react-tabs';
@ -84,7 +84,7 @@ export class ResponsePane extends PureComponent<Props> {
}
const { contentType } = response;
const extension = mime.extension(contentType) || 'unknown';
const extension = mimeExtension(contentType) || 'unknown';
const { canceled, filePath: outputPath } = await window.dialog.showSaveDialog({
title: 'Save Response Body',
buttonLabel: 'Save',

View File

@ -1,7 +1,7 @@
import { autoBindMethodsForReact } from 'class-autobind-decorator';
import { SaveDialogOptions } from 'electron';
import fs from 'fs';
import mimes from 'mime-types';
import { extension as mimeExtension } from 'mime-types';
import moment from 'moment';
import multiparty from 'multiparty';
import path from 'path';
@ -130,7 +130,7 @@ export class ResponseMultipartViewer extends PureComponent<Props, State> {
}
const contentType = getContentTypeFromHeaders(part.headers, 'text/plain');
const extension = mimes.extension(contentType) || '.txt';
const extension = mimeExtension(contentType) || '.txt';
const lastDir = window.localStorage.getItem('insomnia.lastExportPath');
const dir = lastDir || window.app.getPath('desktop');
const date = moment().format('YYYY-MM-DD');

View File

@ -2,7 +2,7 @@ import { autoBindMethodsForReact } from 'class-autobind-decorator';
import { clipboard, ipcRenderer, SaveDialogOptions } from 'electron';
import fs from 'fs';
import HTTPSnippet from 'httpsnippet';
import * as mime from 'mime-types';
import { extension as mimeExtension } from 'mime-types';
import * as path from 'path';
import React, { createRef, PureComponent } from 'react';
import { connect } from 'react-redux';
@ -729,8 +729,8 @@ class App extends PureComponent<AppProps, State> {
responsePatch.statusCode >= 200 &&
responsePatch.statusCode < 300
) {
// @ts-expect-error -- TSCONVERSION contentType can be undefined
const extension = mime.extension(responsePatch.contentType) || 'unknown';
const sanitizedExtension = responsePatch.contentType && mimeExtension(responsePatch.contentType);
const extension = sanitizedExtension || 'unknown';
const name =
nameFromHeader || `${request.name.replace(/\s/g, '-').toLowerCase()}.${extension}`;
let filename;

View File

@ -41,8 +41,8 @@
"jsonlint-mod-fixed": "1.7.7",
"jsonpath-plus": "^6.0.1",
"jwt-authentication": "^0.4.0",
"marked": "^4.0.12",
"mime-types": "^2.1.18",
"marked": "^4.0.10",
"mime-types": "^2.1.35",
"mkdirp": "^0.5.1",
"moment": "^2.21.0",
"multiparty": "^4.2.1",
@ -108,7 +108,7 @@
"@types/less": "^3.0.2",
"@types/license-checker": "^25.0.1",
"@types/marked": "^4.0.2",
"@types/mime-types": "^2.1.0",
"@types/mime-types": "^2.1.1",
"@types/mkdirp": "^0.5.2",
"@types/multiparty": "^0.0.32",
"@types/ncp": "^2.0.4",
@ -7115,9 +7115,9 @@
"dev": true
},
"node_modules/@types/mime-types": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.0.tgz",
"integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM=",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.1.tgz",
"integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==",
"dev": true
},
"node_modules/@types/minimatch": {
@ -21442,19 +21442,19 @@
}
},
"node_modules/mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.44.0"
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
@ -36539,9 +36539,9 @@
"dev": true
},
"@types/mime-types": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.0.tgz",
"integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM=",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.1.tgz",
"integrity": "sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==",
"dev": true
},
"@types/minimatch": {
@ -47981,16 +47981,16 @@
"dev": true
},
"mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
},
"mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"requires": {
"mime-db": "1.44.0"
"mime-db": "1.52.0"
}
},
"mimic-fn": {

View File

@ -133,8 +133,8 @@
"jsonlint-mod-fixed": "1.7.7",
"jsonpath-plus": "^6.0.1",
"jwt-authentication": "^0.4.0",
"marked": "^4.0.12",
"mime-types": "^2.1.18",
"marked": "^4.0.10",
"mime-types": "^2.1.35",
"mkdirp": "^0.5.1",
"moment": "^2.21.0",
"multiparty": "^4.2.1",
@ -200,8 +200,8 @@
"@types/js-yaml": "^4.0.1",
"@types/less": "^3.0.2",
"@types/license-checker": "^25.0.1",
"@types/mime-types": "^2.1.1",
"@types/marked": "^4.0.2",
"@types/mime-types": "^2.1.0",
"@types/mkdirp": "^0.5.2",
"@types/multiparty": "^0.0.32",
"@types/ncp": "^2.0.4",

View File

@ -27,7 +27,7 @@
"jsonlint-mod-fixed": "1.7.7",
"jsonpath-plus": "^6.0.1",
"marked": "^4.0.12",
"mime-types": "^2.1.27",
"mime-types": "^2.1.35",
"mkdirp": "^1.0.4",
"multiparty": "^4.2.1",
"nedb": "^1.8.0",
@ -2413,19 +2413,19 @@
}
},
"node_modules/mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.44.0"
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
@ -5698,16 +5698,16 @@
}
},
"mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
},
"mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"requires": {
"mime-db": "1.44.0"
"mime-db": "1.52.0"
}
},
"mimic-response": {

View File

@ -29,7 +29,7 @@
"jsonlint-mod-fixed": "1.7.7",
"jsonpath-plus": "^6.0.1",
"marked": "^4.0.12",
"mime-types": "^2.1.27",
"mime-types": "^2.1.35",
"mkdirp": "^1.0.4",
"multiparty": "^4.2.1",
"nedb": "^1.8.0",