Commit 253ebe82 authored by Tristan Cavelier's avatar Tristan Cavelier

Fix bug: DavStorage methods can now work correctly on chrom{e,ium}

On Google Chrome or Chromium, requests methods (POST,PUT,GET,DELETE) act on the
internal browser cache, so important action like PUT could not work.
The Url sended with the request is appended by '?_=xxx' (which 'xxx' is the
current date in ms) to make this Url unique.
parent ec64779f
...@@ -79,12 +79,12 @@ var newDAVStorage = function ( spec, my ) { ...@@ -79,12 +79,12 @@ var newDAVStorage = function ( spec, my ) {
priv.putOrPost = function (command,type) { priv.putOrPost = function (command,type) {
var secured_docid = priv.secureDocId(command.getDocId()); var secured_docid = priv.secureDocId(command.getDocId());
$.ajax ( { $.ajax ( {
url: priv.url + '/' + url: priv.url + '/' +
priv.secured_username + '/' + priv.secured_username + '/' +
priv.secured_applicationname + '/' + priv.secured_applicationname + '/' +
secured_docid, secured_docid + '?_=' + Date.now(), // to make url unique!
// and avoid chrome PUT on cache !
type: type, type: type,
data: command.getDocContent(), data: command.getDocContent(),
async: true, async: true,
...@@ -128,7 +128,7 @@ var newDAVStorage = function ( spec, my ) { ...@@ -128,7 +128,7 @@ var newDAVStorage = function ( spec, my ) {
url: priv.url + '/' + url: priv.url + '/' +
priv.secured_username + '/' + priv.secured_username + '/' +
priv.secured_applicationname + '/' + priv.secured_applicationname + '/' +
secured_docid, secured_docid + '?_=' + Date.now(),
type: "GET", type: "GET",
async: true, async: true,
dataType: 'text', // TODO is it necessary ? dataType: 'text', // TODO is it necessary ?
...@@ -164,7 +164,7 @@ var newDAVStorage = function ( spec, my ) { ...@@ -164,7 +164,7 @@ var newDAVStorage = function ( spec, my ) {
url: priv.url + '/' + url: priv.url + '/' +
priv.secured_username + '/' + priv.secured_username + '/' +
priv.secured_applicationname + '/' + priv.secured_applicationname + '/' +
secured_docid, secured_docid + '?_=' + Date.now(),
type: "PROPFIND", type: "PROPFIND",
async: true, async: true,
dataType: 'xml', dataType: 'xml',
...@@ -219,7 +219,7 @@ var newDAVStorage = function ( spec, my ) { ...@@ -219,7 +219,7 @@ var newDAVStorage = function ( spec, my ) {
url: priv.url + '/' + url: priv.url + '/' +
priv.secured_username + '/' + priv.secured_username + '/' +
priv.secured_applicationname + '/' + priv.secured_applicationname + '/' +
priv.secureDocId(file.id), priv.secureDocId(file.id) + '?_=' + Date.now(),
type: "GET", type: "GET",
async: true, async: true,
dataType: 'text', // TODO : is it necessary ? dataType: 'text', // TODO : is it necessary ?
...@@ -246,7 +246,7 @@ var newDAVStorage = function ( spec, my ) { ...@@ -246,7 +246,7 @@ var newDAVStorage = function ( spec, my ) {
$.ajax ( { $.ajax ( {
url: priv.url + '/' + url: priv.url + '/' +
priv.secured_username + '/' + priv.secured_username + '/' +
priv.secured_applicationname + '/', priv.secured_applicationname + '/' + '?_=' + Date.now(),
async: true, async: true,
type: 'PROPFIND', type: 'PROPFIND',
dataType: 'xml', dataType: 'xml',
...@@ -339,12 +339,11 @@ var newDAVStorage = function ( spec, my ) { ...@@ -339,12 +339,11 @@ var newDAVStorage = function ( spec, my ) {
that.remove = function (command) { that.remove = function (command) {
var secured_docid = priv.secureDocId(command.getDocId()); var secured_docid = priv.secureDocId(command.getDocId());
$.ajax ( { $.ajax ( {
url: priv.url + '/' + url: priv.url + '/' +
priv.secured_username + '/' + priv.secured_username + '/' +
priv.secured_applicationname + '/' + priv.secured_applicationname + '/' +
secured_docid, secured_docid + '?_=' + Date.now(),
type: "DELETE", type: "DELETE",
async: true, async: true,
headers: {'Authorization':'Basic '+Base64.encode( headers: {'Authorization':'Basic '+Base64.encode(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment