Skip to content

Commit 29784d2

Browse files
Merge pull request #96 from terminusdb/fix/replaceall
fixed replaceAll is not a function error #95
2 parents 3ff1996 + 7876f73 commit 29784d2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/utils.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const Utils = {}
1414
Utils.encodeURISegment = function(str){
1515
if(typeof str !== 'string') return str
1616
str = encodeURI(str)
17-
str = str.replaceAll('?','%3F')
18-
str = str.replaceAll('=','%3D')
19-
str = str.replaceAll('&','%26')
17+
str = str.replace(/\?/g,'%3F')
18+
str = str.replace(/=/g,'%3D')
19+
str = str.replace(/&/g,'%26')
2020

2121
return str
2222
}

lib/woqlClient.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ WOQLClient.prototype.connect = function(params) {
355355
if (params) this.connectionConfig.update(params)
356356
// unset the current server setting until successful connect
357357
return this.dispatch(CONST.GET, this.connectionConfig.apiURLInfo()).then(response => {
358-
this.databases(response)
358+
//this.databases(response)
359359
return response
360360
})
361361
}
@@ -620,7 +620,11 @@ WOQLClient.prototype.resetBranch = function(branchId, commitId) {
620620
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
621621
*/
622622
WOQLClient.prototype.optimizeBranch = function(branchId) {
623-
return this.dispatch(CONST.OPTIMIZE_SYSTEM, this.connectionConfig.optimizeBranchUrl(branchId), {})
623+
if (branchId) {
624+
return this.dispatch(CONST.OPTIMIZE_SYSTEM, this.connectionConfig.optimizeBranchUrl(branchId), {})
625+
}
626+
let errmsg = `Branch parameter error - you must specify a valid branch id`
627+
return Promise.reject(new Error(ErrorMessage.getInvalidParameterMessage(CONST.BRANCH, errmsg)))
624628
}
625629

626630
/**

0 commit comments

Comments
 (0)