The [data] link in the status log didn't have the &jsonp&auth stuff in it.
Print the fully qualified link, not just the one the user provided.
diff --git a/render.js b/render.js
index 82a1eef..06512f9 100644
--- a/render.js
+++ b/render.js
@@ -1104,7 +1104,7 @@
}
- function getUrlData(url, success_func, error_func) {
+ function extendDataUrl(url) {
// some services expect callback=, some expect jsonp=, so supply both
var plus = 'callback=jsonp&jsonp=jsonp';
var hostpart = urlMinusPath(url);
@@ -1113,13 +1113,16 @@
plus += '&auth=' + encodeURIComponent(auth);
}
- var nurl;
if (url.indexOf('?') >= 0) {
- nurl = url + '&' + plus;
+ return url + '&' + plus;
} else {
- nurl = url + '?' + plus;
+ return url + '?' + plus;
}
- console.debug('fetching data url:', nurl);
+ }
+
+
+ function getUrlData(url, success_func, error_func) {
+ console.debug('fetching data url:', url);
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
@@ -1181,7 +1184,7 @@
error(null, message + ' url=' + xurl + ' line=' + lineno);
};
- iframe.contentWindow.jsonp_url = nurl;
+ iframe.contentWindow.jsonp_url = url;
//TODO(apenwarr): change the domain/origin attribute of the iframe.
// That way the script won't be able to affect us, no matter how badly
@@ -1191,7 +1194,7 @@
// ...but for the moment we have to trust the data provider.
var script = document.createElement('script');
script.async = 1;
- script.src = nurl;
+ script.src = url;
iframe.contentDocument.body.appendChild(script);
}
@@ -1199,7 +1202,9 @@
function _run(query) {
var args = parseArgs(query);
var url = args.get('url');
+ console.debug('original data url:', url);
if (!url) throw new Error('Missing url= in query parameter');
+ url = extendDataUrl(url);
showstatus('Loading <a href="' + encodeURI(url) + '">data</a>...');
getUrlData(url, wrap(gotData, args), wrap(gotError, url));
var editlink = args.get('editlink');