Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Dec 10, 2024
1 parent cb839a6 commit 9628eb0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
5 changes: 1 addition & 4 deletions lib/file_transfer_agent/gcs_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ function GCSUtil(connectionConfig, httpClient, fileStream) {
let axios = httpClient;
const fs = typeof fileStream !== 'undefined' ? fileStream : require('fs');
const connectionProxy = connectionConfig.getProxy();

//Todo Think about Bypass when NOproxy is configured.
const originalHttpsProxy = process.env[HTTPS_PROXY];
let isEnvProxyOverridden = false;
let proxyString = null;
Expand All @@ -69,7 +67,7 @@ function GCSUtil(connectionConfig, httpClient, fileStream) {
this.createClient = function (stageInfo) {
const stageCredentials = stageInfo['creds'];
const gcsToken = stageCredentials['GCS_ACCESS_TOKEN'];
//TODO: SNOW-1789759 hardcoded region will be replaced in the future
//TODO: SNOW-1789759 the value is hardcoded now, but it should be server driven
const isRegionalUrlEnabled = (stageInfo.region).toLowerCase() === 'me-central2' || stageInfo.useRegionalUrl;
let endPoint = null;
if (stageInfo['endPoint']) {
Expand Down Expand Up @@ -111,7 +109,6 @@ function GCSUtil(connectionConfig, httpClient, fileStream) {
}
}


if (typeof httpClient === 'undefined') {
const proxyAgent = getProxyAgent(connectionProxy, new URL(connectionConfig.accessUrl), endPoint || `storage.${stageInfo.region.toLowerCase()}.rep.googleapis.com` );
axios = require('axios').create({
Expand Down
7 changes: 2 additions & 5 deletions lib/proxy_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@ exports.getCompareAndLogEnvAndAgentProxies = function (agentOptions) {
// check if both the PROXY envvars and Connection proxy config is set
// generate warnings if they are, and are also different
if (envProxy.httpProxy &&
this.removeScheme(envProxy.httpProxy).toLowerCase() !==
this.removeScheme(proxyString)) {
this.removeScheme(envProxy.httpProxy).toLowerCase() !== proxyString.toLowerCase()) {
logMessages.warnings = logMessages.warnings + ` Using both the HTTP_PROXY (${envProxy.httpProxy})`
+ ` and the proxyHost:proxyPort (${proxyHostAndPort}) settings to connect, but with different values.`
+ ' If you experience connectivity issues, try unsetting one of them.';
}
if (envProxy.httpsProxy &&
this.removeScheme(envProxy.httpsProxy).toLowerCase() !==
this.removeScheme(proxyString)) {
if (envProxy.httpsProxy && this.removeScheme(envProxy.httpsProxy).toLowerCase() !== proxyString.toLowerCase()) {
logMessages.warnings = logMessages.warnings + ` Using both the HTTPS_PROXY (${envProxy.httpsProxy})`
+ ` and the proxyHost:proxyPort (${proxyHostAndPort}) settings to connect, but with different values.`
+ ' If you experience connectivity issues, try unsetting one of them.';
Expand Down
5 changes: 4 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,10 @@ exports.isNotEmptyAsString = function (variable) {
};

exports.isEmptyObject = (object) => {
if (typeof object !== 'object' || object instanceof Array) {
if (!this.exists(object)) {
return true;
}
if (typeof object !== 'object') {
return false;
}
return Object.keys(object).length === 0;
Expand Down
19 changes: 14 additions & 5 deletions test/unit/util_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1255,24 +1255,33 @@ describe('Util', function () {
result: false,
},
{
name: 'non object(int)"',
name: 'non object(int)',
value: 123,
result: false,
},
{
name: 'non object(int)"',
name: 'non object(int)',
value: 123,
result: false,
},
{
name: 'array"',
name: 'array',
value: [1, 2, 3],
result: false,
},
{
name: 'empty array"',
name: 'empty array',
value: [],
result: false,
result: true,
},
{
name: 'null',
value: null,
result: true,
}, {
name: 'undefined',
value: undefined,
result: true,
},
];

Expand Down

0 comments on commit 9628eb0

Please sign in to comment.