From cceccebc9ba00adc837abd4ab4f17b48b8dc1163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= Date: Fri, 12 Oct 2018 13:54:00 +0100 Subject: [PATCH] small sid code fix --- src/js/base/api.js | 2 +- src/js/ripe-min.js | 2 +- src/js/ripe.js | 2 +- src/python/ripe_demo/static/js/ripe.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/base/api.js b/src/js/base/api.js index e4ffa1bd7..7068fde55 100644 --- a/src/js/base/api.js +++ b/src/js/base/api.js @@ -404,7 +404,7 @@ ripe.Ripe.prototype._build = function(options) { var method = options.method || "GET"; var params = options.params || {}; var auth = options.auth || false; - if (auth !== undefined && auth !== null) { + if (auth && this.sid !== undefined && this.sid !== null) { params.sid = this.sid; } options.url = url; diff --git a/src/js/ripe-min.js b/src/js/ripe-min.js index ecb44a108..84623faeb 100644 --- a/src/js/ripe-min.js +++ b/src/js/ripe-min.js @@ -71,7 +71,7 @@ if(options.crop!==undefined&&options.crop!==null){params.crop=options.crop?"1":" if(options.profile!==undefined&&options.profile!==null){params.initials_profile=options.profile.join(",");} var initials=options.initials===""?"$empty":options.initials;if(options.initials!==undefined&&options.initials!==null){params.initials=initials;} var url=this.url+"compose";return Object.assign(options,{url:url,method:"GET",params:params});};ripe.Ripe.prototype._getMaskOptions=function(options){options=options||{};options.parts=options.parts||{};options.country=options.country||null;options.currency=options.currency||null;options=this._getQueryOptions(options);var params=options.params||{};options.params=params;if(options.part!==undefined&&options.part!==null){params.part=options.part;} -var url=this.url+"mask";return Object.assign(options,{url:url,method:"GET",params:params});};ripe.Ripe.prototype._getImageURL=function(options){options=this._getImageOptions(options);return options.url+"?"+this._buildQuery(options.params);};ripe.Ripe.prototype._getMaskURL=function(options){options=this._getMaskOptions(options);return options.url+"?"+this._buildQuery(options.params);};ripe.Ripe.prototype._build=function(options){var url=options.url||"";var method=options.method||"GET";var params=options.params||{};var auth=options.auth||false;if(auth!==undefined&&auth!==null){params.sid=this.sid;} +var url=this.url+"mask";return Object.assign(options,{url:url,method:"GET",params:params});};ripe.Ripe.prototype._getImageURL=function(options){options=this._getImageOptions(options);return options.url+"?"+this._buildQuery(options.params);};ripe.Ripe.prototype._getMaskURL=function(options){options=this._getMaskOptions(options);return options.url+"?"+this._buildQuery(options.params);};ripe.Ripe.prototype._build=function(options){var url=options.url||"";var method=options.method||"GET";var params=options.params||{};var auth=options.auth||false;if(auth&&this.sid!==undefined&&this.sid!==null){params.sid=this.sid;} options.url=url;options.method=method;options.params=params;options.auth=auth;return options;};ripe.Ripe.prototype._buildQuery=function(params){var key;var value;var index;var buffer=[];if(Array.isArray(params)){for(index=0;index1?tuple[1]:"";key=encodeURIComponent(key);value=encodeURIComponent(value);buffer.push(key+"="+value);}}else{var keys=Object.keys(params);keys.sort();for(index=0;index