Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
// The following properties/methods aren't defined in the typings file
const blobTypeConstants = (Azure.Constants.BlobConstants as any).ListBlobTypes
const listBlobType = (type == 'prefix') ? blobTypeConstants.Directory : blobTypeConstants.Blob
const clientAny = this._client as any
clientAny._listBlobsOrDircotriesSegmentedWithPrefix(container, prefix || null, continuationToken, listBlobType, {delimiter: '/'}, (err, response) => {
if (err) {
return reject(err)
}
// Iterate through the list of items and add objects to the result list
for (const i in response.entries) {
if (response.entries.hasOwnProperty(i)) {
const e = response.entries[i]
// Is this a prefix (folder) or object? If etag is present, it's an object
if (e.etag) {
const res = {
'use strict';
const assert = require('assert');
const qs = require('qs');
const { AccountSasConstants } = require('azure-storage').Constants;
const parseSASToken = require('../lib/util/parseSASToken');
const { Permissions, Protocols, Resources } = AccountSasConstants;
const { parsePermissions, parseResources, parseProtocols } = parseSASToken;
describe('Parse SAS token', () => {
context('parse protocols', () => {
it('should parse "https" as HTTPSONLY', () => {
assert.equal(parseProtocols('https'), Protocols.HTTPSONLY);
});
it('should parse "http" as HTTPSORHTTP', () => {
assert.equal(parseProtocols('http'), Protocols.HTTPSORHTTP);
});
const url = require('url');
const azure = require('azure-storage');
const errors = require('../../../errors');
const azureMpuUtils = require('../../../s3middleware/azureHelpers/mpuUtils');
const { validateAndFilterMpuParts } =
require('../../../s3middleware/processMpuParts');
const { createLogger, logHelper, translateAzureMetaHeaders } =
require('./utils');
const constants = require('../../../constants');
const packageVersion = require('../../../../package.json').version;
azure.Constants.USER_AGENT_PRODUCT_NAME = constants.productName;
azure.Constants.USER_AGENT_PRODUCT_VERSION = packageVersion;
class AzureClient {
constructor(config) {
this._azureStorageEndpoint = config.azureStorageEndpoint;
this._azureStorageCredentials = config.azureStorageCredentials;
this._azureContainerName = config.azureContainerName;
this._client = azure.createBlobService(
this._azureStorageCredentials.storageAccountName,
this._azureStorageCredentials.storageAccessKey,
this._azureStorageEndpoint);
this._dataStoreName = config.dataStoreName;
this._bucketMatch = config.bucketMatch;
if (config.proxy && config.proxy.url) {
const parsedUrl = url.parse(config.proxy.url);
if (!parsedUrl.port) {
parsedUrl.port = 80;
const url = require('url');
const azure = require('azure-storage');
const errors = require('../../../errors');
const azureMpuUtils = require('../../../s3middleware/azureHelpers/mpuUtils');
const { validateAndFilterMpuParts } =
require('../../../s3middleware/processMpuParts');
const { createLogger, logHelper, translateAzureMetaHeaders } =
require('./utils');
const constants = require('../../../constants');
const packageVersion = require('../../../../package.json').version;
azure.Constants.USER_AGENT_PRODUCT_NAME = constants.productName;
azure.Constants.USER_AGENT_PRODUCT_VERSION = packageVersion;
class AzureClient {
constructor(config) {
this._azureStorageEndpoint = config.azureStorageEndpoint;
this._azureStorageCredentials = config.azureStorageCredentials;
this._azureContainerName = config.azureContainerName;
this._client = azure.createBlobService(
this._azureStorageCredentials.storageAccountName,
this._azureStorageCredentials.storageAccessKey,
this._azureStorageEndpoint);
this._dataStoreName = config.dataStoreName;
this._bucketMatch = config.bucketMatch;
if (config.proxy && config.proxy.url) {
const parsedUrl = url.parse(config.proxy.url);
if (!parsedUrl.port) {
'use strict';
const qs = require('qs');
const { AccountSasConstants } = require('azure-storage').Constants;
const { Permissions, Protocols, Resources } = AccountSasConstants;
function parseSASToken(sasToken) {
sasToken = qs.parse((sasToken || '').replace(/^\?/, ''));
return {
AccessPolicy: {
Expiry : sasToken.se && new Date(sasToken.se),
IPAddressOrRange: sasToken.sip,
Permissions : parsePermissions(sasToken.sp),
Protocols : parseProtocols(sasToken.spr),
ResourceTypes : parseResources(sasToken.sr),
Start : sasToken.st && new Date(sasToken.st)
}
};
}