Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

documentdb

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

documentdb - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

4

changelog.md

@@ -0,1 +1,5 @@

## Changes in 1.5.3 : ##
- Properly handle dashes in the mediaIds
## Changes in 1.5.2 : ##

@@ -2,0 +6,0 @@

8

lib/base.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc