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 ) {
priv.putOrPost = function (command,type) {
var secured_docid = priv.secureDocId(command.getDocId());
$.ajax ( {
url: priv.url + '/' +
priv.secured_username + '/' +
priv.secured_applicationname + '/' +
secured_docid,
secured_docid + '?_=' + Date.now(), // to make url unique!
// and avoid chrome PUT on cache !
type: type,
data: command.getDocContent(),
async: true,
......@@ -128,7 +128,7 @@ var newDAVStorage = function ( spec, my ) {
url: priv.url + '/' +
priv.secured_username + '/' +
priv.secured_applicationname + '/' +
secured_docid,
secured_docid + '?_=' + Date.now(),
type: "GET",
async: true,
dataType: 'text', // TODO is it necessary ?
......@@ -164,7 +164,7 @@ var newDAVStorage = function ( spec, my ) {
url: priv.url + '/' +
priv.secured_username + '/' +
priv.secured_applicationname + '/' +
secured_docid,
secured_docid + '?_=' + Date.now(),
type: "PROPFIND",
async: true,
dataType: 'xml',
......@@ -219,7 +219,7 @@ var newDAVStorage = function ( spec, my ) {
url: priv.url + '/' +
priv.secured_username + '/' +
priv.secured_applicationname + '/' +
priv.secureDocId(file.id),
priv.secureDocId(file.id) + '?_=' + Date.now(),
type: "GET",
async: true,
dataType: 'text', // TODO : is it necessary ?
......@@ -246,7 +246,7 @@ var newDAVStorage = function ( spec, my ) {
$.ajax ( {
url: priv.url + '/' +
priv.secured_username + '/' +
priv.secured_applicationname + '/',
priv.secured_applicationname + '/' + '?_=' + Date.now(),
async: true,
type: 'PROPFIND',
dataType: 'xml',
......@@ -339,12 +339,11 @@ var newDAVStorage = function ( spec, my ) {
that.remove = function (command) {
var secured_docid = priv.secureDocId(command.getDocId());
$.ajax ( {
url: priv.url + '/' +
priv.secured_username + '/' +
priv.secured_applicationname + '/' +
secured_docid,
secured_docid + '?_=' + Date.now(),
type: "DELETE",
async: true,
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