Skip to content

Commit 6568bbe

Browse files
authored
Merge pull request #239 from terminusdb/coveralls-next
fix encoding
2 parents c111851 + 2e7c9f3 commit 6568bbe

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ Utils.encodeURISegment = function (str) {
4444
if (typeof str !== 'string') return str;
4545
str = encodeURI(str);
4646
str = str.replace(/\?/g, '%3F');
47+
// we not need = because the server does not encode it
4748
// str = str.replace(/=/g, '%3D');
48-
// str = str.replace(/&/g, '%26');
49+
// str = str.replace(/@/g, '%40');
50+
str = str.replace(/&/g, '%26');
4951
str = str.replace(/\+/g, '%2B');
5052
str = str.replace(/#/g, '%23');
51-
// str = str.replace(/@/g, '%40');
5253
return str;
5354
};
5455

test/connectionConfing.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ describe('connectionConfig tests', () => {
269269
it('check baseUrlEncode', function() {
270270
const db = "%6277&ˆˆˆ@ˆˆWˆTWTET#Y@&&GHHSHHS"
271271
connectionConfig.setDB(db)
272-
const dbBase = 'http://localhost:6363/api/woql/123/%256277&%CB%86%CB%86%CB%86@%CB%86%CB%86W%CB%86TWTET%23Y@&&GHHSHHS'
272+
const dbBase = 'http://localhost:6363/api/woql/123/%256277%26%CB%86%CB%86%CB%86@%CB%86%CB%86W%CB%86TWTET%23Y@%26%26GHHSHHS'
273273
expect(connectionConfig.dbBase('woql')).to.equal(dbBase)
274274
expect(connectionConfig.db()).to.equal(db)
275275

test/utils.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ describe('utils tests', () => {
120120
});
121121

122122
it('encodeURISegment test &&26567 organization name', () => {
123-
expect(UTILS.encodeURISegment("&&26567")).to.equal("&&26567");
123+
expect(UTILS.encodeURISegment("&&26567")).to.equal("%26%2626567");
124124
});
125125

126126
it('encodeURISegment test %6277&ˆˆˆ@ˆˆWˆTWTET#Y@&&GHHSHHS organization name', () => {
127-
expect(UTILS.encodeURISegment("%6277&ˆˆˆ@ˆˆWˆTWTET#Y@&&GHHSHHS")).to.equal("%256277&%CB%86%CB%86%CB%86@%CB%86%CB%86W%CB%86TWTET%23Y@&&GHHSHHS");
127+
expect(UTILS.encodeURISegment("%6277&ˆˆˆ@ˆˆWˆTWTET#Y@&&GHHSHHS")).to.equal("%256277%26%CB%86%CB%86%CB%86@%CB%86%CB%86W%CB%86TWTET%23Y@%26%26GHHSHHS");
128128
});
129129

130130
/* it('check convertTimestampToXsd',function(){

0 commit comments

Comments
 (0)