Skip to content

Commit

Permalink
fix errors from merging
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Dec 20, 2024
1 parent bf4eb28 commit a969e08
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 46 deletions.
20 changes: 2 additions & 18 deletions lib/file_transfer_agent/gcs_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const FileHeader = require('./file_util').FileHeader;
const getProxyAgent = require('../http/node').getProxyAgent;
const ProxyUtil = require('../proxy_util');
const Util = require('../util');
const { shouldPerformGCPBucket } = require('../util');
const { shouldPerformGCPBucket, lstrip } = require('../util');


const GCS_METADATA_PREFIX = 'x-goog-meta-';
Expand Down Expand Up @@ -91,22 +91,6 @@ function GCSUtil(connectionConfig, httpClient, fileStream) {
client = null;
}

// if (typeof httpClient === 'undefined') {
// const proxy = ProxyUtil.getProxy(connectionConfig.getProxy(), 'GCS Util');

// //When http_proxy is enabled, the driver should use Axios for HTTPS requests to avoid relying on HTTP_PROXY in GCS.
// if (proxy || Util.getEnvVar('http_proxy')) {
// isProxyEnabled = true;
// const proxyAgent = getProxyAgent(proxy, new URL(connectionConfig.accessUrl), endPoint || `storage.${stageInfo.region.toLowerCase()}.rep.googleapis.com` );
// axios = require('axios').create({
// proxy: false,
// httpAgent: proxyAgent,
// httpsAgent: proxyAgent,
// });
// } else {
// axios = require('axios');
// }
// }
process.nextTick(() => this.setupHttpClient(endPoint));

return client;
Expand Down Expand Up @@ -491,7 +475,7 @@ function GCSUtil(connectionConfig, httpClient, fileStream) {
endPoint = `storage.${stageInfo.region.toLowerCase()}.rep.googleapis.com`;
}
return endPoint;
}
};

this.setupHttpClient = function (endPoint) {
if (typeof httpClient === 'undefined') {
Expand Down
57 changes: 29 additions & 28 deletions test/unit/util_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1269,33 +1269,34 @@ describe('Util', function () {
});
});

describe('lstrip function Test', function () {
const testCases = [
{
name: 'remove consecutive characters /',
str: '///////////helloworld',
remove: '/',
result: 'helloworld'
},
{
name: 'when the first character is not matched with the remove character',
str: '/\\/\\helloworld',
remove: '\\',
result: '/\\/\\helloworld'
},
{
name: 'when the first and the third characters are matched',
str: '@1@12345helloworld',
remove: '@',
result: '1@12345helloworld'
},
];
describe('lstrip function Test', function () {
const testCases = [
{
name: 'remove consecutive characters /',
str: '///////////helloworld',
remove: '/',
result: 'helloworld'
},
{
name: 'when the first character is not matched with the remove character',
str: '/\\/\\helloworld',
remove: '\\',
result: '/\\/\\helloworld'
},
{
name: 'when the first and the third characters are matched',
str: '@1@12345helloworld',
remove: '@',
result: '1@12345helloworld'
},
];

for (const { name, str, remove, result } of testCases) {
it(name, function () {
assert.strictEqual(Util.lstrip(str, remove), result);
});
}
});
for (const { name, str, remove, result } of testCases) {
it(name, function () {
assert.strictEqual(Util.lstrip(str, remove), result);
});
}
});

});
});
});

0 comments on commit a969e08

Please sign in to comment.