X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/77de5063128440bd88623f634c522b8933770f2e..a1af4d5de13e8a2094089453cbae6478739bd2c8:/app/assets/javascripts/oauth.js diff --git a/app/assets/javascripts/oauth.js b/app/assets/javascripts/oauth.js index aac63f243..98ce302e1 100644 --- a/app/assets/javascripts/oauth.js +++ b/app/assets/javascripts/oauth.js @@ -1,6 +1,12 @@ //= require ohauth $(document).ready(function () { + function makeAbsolute(url) { + var a = document.createElement('a'); + a.href = url; + return a.href; + } + if (OSM.oauth_token) { var headerGenerator = window.ohauth.headerGenerator({ consumer_key: OSM.oauth_consumer_key, @@ -12,7 +18,7 @@ $(document).ready(function () { $.ajaxPrefilter(function(options, jqxhr) { if (options.oauth) { options.headers = options.headers || {}; - options.headers.Authorization = headerGenerator(options.type, options.url, jqxhr.data); + options.headers.Authorization = headerGenerator(options.type, makeAbsolute(options.url), jqxhr.data); } }); }