Skip to content

Commit 7eb095a

Browse files
committed
feat: avoid decoding when noEncoding is true
1 parent 6bd286d commit 7eb095a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

unbxdSearch.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -557,16 +557,16 @@ var unbxdSearchInit = function(jQuery, Handlebars){
557557
this.reset();
558558

559559
var cur_url = this.getUrlSubstring()
560-
,urlqueryparams = this.getQueryParams(cur_url)
561-
// add test to check if the url is encoded,
562-
// decode the query parameters only if url is encoded
563-
// fixes SKU searches like writ0035/WRIT0035 & HSWD0015
564-
,decodedParams = !(/[^A-Za-z0-9\+\/\=]/g.test(cur_url)) ? this.getQueryParams(this.decode(cur_url)) : {}
565-
,queryparamcount = Object.keys(urlqueryparams).length
566-
,decodedParamscount = Object.keys(decodedParams).length
567-
,finalParams = null;
568-
569-
if(!this.options.noEncoding && decodedParamscount > 0){
560+
, urlqueryparams = this.getQueryParams(cur_url)
561+
// add test to check if the url is encoded,
562+
// decode the query parameters only if url is encoded
563+
// fixes SKU searches like writ0035/WRIT0035 & HSWD0015
564+
, decodedParams = !(this.options.noEncoding && /[^A-Za-z0-9\+\/\=]/g.test(cur_url)) ? this.getQueryParams(this.decode(cur_url)) : {}
565+
, queryparamcount = Object.keys(urlqueryparams).length
566+
, decodedParamscount = Object.keys(decodedParams).length
567+
, finalParams = null;
568+
569+
if (!this.options.noEncoding && decodedParamscount > 0) {
570570
finalParams = this._processURL(decodedParams);
571571
}else{
572572
finalParams = this._processURL(urlqueryparams);

0 commit comments

Comments
 (0)