mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 14:19:58 +00:00
More unique temporary directory (Closes #568)
This commit is contained in:
parent
44449114a9
commit
db1ae27fb2
@ -24,6 +24,11 @@ export function getAppEnvironment () {
|
||||
return process.env.INSOMNIA_ENV || 'production';
|
||||
}
|
||||
|
||||
export function getTempDir () {
|
||||
// NOTE: Using a fairly unique name here because "insomnia" is a common word
|
||||
return path.join(electron.remote.app.getPath('temp'), `insomnia_${getAppVersion()}`);
|
||||
}
|
||||
|
||||
export function isMac () {
|
||||
return getAppPlatform() === 'darwin';
|
||||
}
|
||||
|
@ -5,8 +5,6 @@ import type {Workspace} from '../models/workspace';
|
||||
import type {Settings} from '../models/settings';
|
||||
import type {RenderedRequest} from '../common/render';
|
||||
import {getRenderContext, getRenderedRequest} from '../common/render';
|
||||
|
||||
import electron from 'electron';
|
||||
import mkdirp from 'mkdirp';
|
||||
import clone from 'clone';
|
||||
import {parse as urlParse, resolve as urlResolve} from 'url';
|
||||
@ -15,7 +13,7 @@ import {join as pathJoin} from 'path';
|
||||
import * as models from '../models';
|
||||
import * as querystring from '../common/querystring';
|
||||
import * as util from '../common/misc.js';
|
||||
import {AUTH_AWS_IAM, AUTH_BASIC, AUTH_DIGEST, AUTH_NETRC, AUTH_NTLM, CONTENT_TYPE_FORM_DATA, CONTENT_TYPE_FORM_URLENCODED, getAppVersion, STATUS_CODE_PLUGIN_ERROR} from '../common/constants';
|
||||
import {AUTH_AWS_IAM, AUTH_BASIC, AUTH_DIGEST, AUTH_NETRC, AUTH_NTLM, CONTENT_TYPE_FORM_DATA, CONTENT_TYPE_FORM_URLENCODED, getAppVersion, getTempDir, STATUS_CODE_PLUGIN_ERROR} from '../common/constants';
|
||||
import {describeByteSize, getContentTypeHeader, hasAuthHeader, hasContentTypeHeader, hasUserAgentHeader, setDefaultProtocol} from '../common/misc';
|
||||
import fs from 'fs';
|
||||
import * as db from '../common/database';
|
||||
@ -257,7 +255,7 @@ export function _actuallySend (
|
||||
// Setup CA Root Certificates if not on Mac. Thanks to libcurl, Mac will use
|
||||
// certificates form the OS.
|
||||
if (process.platform !== 'darwin') {
|
||||
const basCAPath = pathJoin(electron.remote.app.getPath('temp'), 'insomnia');
|
||||
const basCAPath = getTempDir();
|
||||
const fullCAPath = pathJoin(basCAPath, CACerts.filename);
|
||||
|
||||
try {
|
||||
@ -348,7 +346,7 @@ export function _actuallySend (
|
||||
// Certificate file now found!
|
||||
// LEGACY: Certs used to be stored in blobs (not as paths), so lets write it to
|
||||
// the temp directory first.
|
||||
const fullBase = pathJoin(electron.remote.app.getPath('temp'), 'insomnia');
|
||||
const fullBase = getTempDir();
|
||||
mkdirp.sync(fullBase);
|
||||
|
||||
const name = `${renderedRequest._id}_${renderedRequest.modified}`;
|
||||
|
Loading…
Reference in New Issue
Block a user