documentdb
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -0,1 +1,5 @@ | ||
## Changes in 1.5.3 : ## | ||
- Properly handle dashes in the mediaIds | ||
## Changes in 1.5.2 : ## | ||
@@ -2,0 +6,0 @@ |
@@ -319,7 +319,9 @@ /* | ||
getAttachmentIdFromMediaId: function(mediaId) { | ||
var buffer = new Buffer(mediaId, "base64"); | ||
// Replace - with / on the incoming mediaId. This will preserve the / so that we can revert it later. | ||
var buffer = new Buffer(mediaId.replace(/-/g, "/"), "base64"); | ||
var ResoureIdLength = 20; | ||
var attachmentId = ""; | ||
if (buffer.length > ResoureIdLength) { | ||
attachmentId = buffer.toString("base64", 0, ResoureIdLength); | ||
// After the base64 conversion, change the / back to a - to get the proper attachmentId | ||
attachmentId = buffer.toString("base64", 0, ResoureIdLength).replace(/\//g, "-"); | ||
} else { | ||
@@ -430,2 +432,2 @@ attachmentId = mediaId; | ||
module.exports = Base; | ||
} | ||
} |
@@ -149,3 +149,3 @@ /* | ||
UserAgent: "documentdb-nodejs-sdk-1.5.2", | ||
UserAgent: "documentdb-nodejs-sdk-1.5.3", | ||
@@ -152,0 +152,0 @@ DefaultPrecisions: { |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"author": "Microsoft Corporation", | ||
@@ -15,0 +15,0 @@ "main": "./index.js", |
@@ -132,1 +132,32 @@ /* | ||
}); | ||
describe("Base.getAttachmentIdFromMediaId", function () { | ||
var test = function (input, expected) { | ||
assert.strictEqual(Base.getAttachmentIdFromMediaId(input), expected); | ||
}; | ||
it("> 20 characters, Alpha-numeric only: 6hl2ALdWbQCxAgAAAAAAAC4b1VoB => 6hl2ALdWbQCxAgAAAAAAAC4b1Vo=", function () { | ||
test("6hl2ALdWbQCxAgAAAAAAAC4-1VoB", "6hl2ALdWbQCxAgAAAAAAAC4-1Vo="); | ||
}); | ||
it("> 20 characters, Single hyphen (-): 6hl2ALdWbQCxAgAAAAAAAC4-1VoB => 6hl2ALdWbQCxAgAAAAAAAC4-1Vo=", function () { | ||
test("6hl2ALdWbQCxAgAAAAAAAC4-1VoB", "6hl2ALdWbQCxAgAAAAAAAC4-1Vo="); | ||
}); | ||
it("> 20 characters, Multiple hyphens (-): 6hl2ALdWb-CxAgAAAAAAAC4-1VoB => 6hl2ALdWb-CxAgAAAAAAAC4-1Vo=", function () { | ||
test("6hl2ALdWb-CxAgAAAAAAAC4-1VoB", "6hl2ALdWb-CxAgAAAAAAAC4-1Vo="); | ||
}); | ||
it("> 20 characters, Plus sign (+): 6hl2ALdWb+CxAgAAAAAAAC4Q1VoB => 6hl2ALdWb+CxAgAAAAAAAC4Q1Vo=", function () { | ||
test("6hl2ALdWb-CxAgAAAAAAAC4-1VoB", "6hl2ALdWb-CxAgAAAAAAAC4-1Vo="); | ||
}); | ||
it("> 20 characters, Plus sign (+), Hyphen (-): 6hl2ALdWb+CxAgAAAAAAAC4-1VoB => 6hl2ALdWb+CxAgAAAAAAAC4-1Vo=", function () { | ||
test("6hl2ALdWb-CxAgAAAAAAAC4-1VoB", "6hl2ALdWb-CxAgAAAAAAAC4-1Vo="); | ||
}); | ||
it("< 20 characters, Plus sign (+), Hyphen (-): 6hl2A-dWb+CxAgAAAA => 6hl2A-dWb+CxAgAAAA", function () { | ||
test("6hl2A-dWb+CxAgAAAA", "6hl2A-dWb+CxAgAAAA"); | ||
}); | ||
}); |
@@ -1,13 +0,30 @@ | ||
##Running the tests | ||
Follow these instructions to run the tests locally. | ||
##Prerequisites | ||
First You need to install mocha | ||
> npm install mocha | ||
1. Clone Azure/azure-documentdb-node repository | ||
Please clone the source and tests from [https://github.com/Azure/azure-documentdb-node](https://github.com/Azure/azure-documentdb-node) | ||
2. Install Node.js and npm | ||
[https://docs.npmjs.com/getting-started/installing-node](https://docs.npmjs.com/getting-started/installing-node) | ||
3. Install mocha package globally | ||
> npm install -g mocha | ||
From the tests folder run | ||
> mocha -t 0 -R spec | ||
##Running the tests | ||
Using your command-line tool, from the root of your local copy of azure-documentdb-node repository: | ||
If you are contributing changes and submitting PR then you need to ensure that you run the tests against your local copy of the source, and not the published npm package. | ||
If you just want to run the tests against the published npm package then skip steps #1 & #2 proceed directly to step #3 | ||
1. Remove documentdb, if previously installed | ||
> npm remove documentdb | ||
2. Install documentdb | ||
> npm install source | ||
3. Change to `source` directory | ||
> cd source | ||
3. Run the tests | ||
> mocha -t 0 -R spec |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
4469027
7531
1