X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/77de5063128440bd88623f634c522b8933770f2e..8fb3d7365fb91d1822ae5f37361af077d48a9c8c:/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); } }); }