summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-12-14 17:42:13 +0100
committerVincent Petry <pvince81@owncloud.com>2015-12-14 17:42:13 +0100
commitab9849e72f9a4ea78dcdd7ce4a87a5353aebd478 (patch)
tree6be58734e067cab169c0ba0a55a214e42de35eea /core/js
parentdb41c4f4b5f27757838ba17c03f6f263b91af527 (diff)
downloadnextcloud-server-ab9849e72f9a4ea78dcdd7ce4a87a5353aebd478.tar.gz
nextcloud-server-ab9849e72f9a4ea78dcdd7ce4a87a5353aebd478.zip
Use Authorization headers for public webdav instead of URL
Instead of prepending the token as username in the URL, use the Authorization header instead. This is because IE9 considers this a cross-domain call and refuses to do it in the first place.
Diffstat (limited to 'core/js')
-rw-r--r--core/js/files/client.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/core/js/files/client.js b/core/js/files/client.js
index 608c2702fbb..70dac7d6690 100644
--- a/core/js/files/client.js
+++ b/core/js/files/client.js
@@ -35,27 +35,25 @@
if (options.useHTTPS) {
url = 'https://';
}
- var credentials = '';
- if (options.userName) {
- credentials += encodeURIComponent(options.userName);
- }
- if (options.password) {
- credentials += ':' + encodeURIComponent(options.password);
- }
- if (credentials.length > 0) {
- url += credentials + '@';
- }
url += options.host + this._root;
this._defaultHeaders = options.defaultHeaders || {'X-Requested-With': 'XMLHttpRequest'};
this._baseUrl = url;
- this._client = new dav.Client({
+
+ var clientOptions = {
baseUrl: this._baseUrl,
xmlNamespaces: {
'DAV:': 'd',
'http://owncloud.org/ns': 'oc'
}
- });
+ };
+ if (options.userName) {
+ clientOptions.userName = options.userName;
+ }
+ if (options.password) {
+ clientOptions.password = options.password;
+ }
+ this._client = new dav.Client(clientOptions);
this._client.xhrProvider = _.bind(this._xhrProvider, this);
};