Opened 6 years ago

Closed 6 years ago

#17094 closed defect (duplicate)

Bug in dojo/request/script

Reported by: rmasse Owned by:
Priority: undecided Milestone: tbd
Component: IO Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:

Description

We've come across a bug when using dojo/request/script on a url ending in json when using {jsonp: "callback"}.

This bug manifested itself in 1.8 and did not present itself in 1.7.

When inspecting the request, the url is improperly manipulated and resembles this: http://mysite.com/q/Canada/Windsor.json[?&]callback=thecallback

I've narrowed it down to line 134 (url += queryParameter) as listed below.

if(options.jsonp){

var queryParameter = new RegExp?('?&' + options.jsonp + '='); if(!queryParameter.test(url)){

url += queryParameter +

(options.frameDoc ? 'parent.' : ) + mid + '_callbacks.' + dfd.id;

}

dfd.canDelete = true; callbacks[dfd.id] = function(json){ response.data = json; dfd.handleResponse(response);

};

}

I've replaced url += queryParameter + with url += '?'+options.jsonp+'='+ in the source and the problem is solved.

As coded, the regex string is injected into the url which it shouldn't be.

Let me know if you need more info.

rmasse@…

Change History (1)

comment:1 Changed 6 years ago by bill

Component: GeneralIO
Resolution: duplicate
Status: newclosed

Duplicate of #16408.

Note: See TracTickets for help on using tickets.