Make "Verify Server" fail if WebDAV server won't serve extensionless file (IIS 6 (and later?) in default configuration according to http://support.microsoft.com/kb/326965 and various forum reports)
This commit is contained in:
parent
ca31a18159
commit
e3df930ca5
2 changed files with 56 additions and 7 deletions
|
@ -49,6 +49,7 @@ Zotero.Sync.Storage = new function () {
|
||||||
this.ERROR_ZOTERO_DIR_NOT_WRITABLE = -13;
|
this.ERROR_ZOTERO_DIR_NOT_WRITABLE = -13;
|
||||||
this.ERROR_NOT_ALLOWED = -14;
|
this.ERROR_NOT_ALLOWED = -14;
|
||||||
this.ERROR_UNKNOWN = -15;
|
this.ERROR_UNKNOWN = -15;
|
||||||
|
this.ERROR_FILE_MISSING_AFTER_UPLOAD = -16;
|
||||||
|
|
||||||
// TEMP
|
// TEMP
|
||||||
// TODO: localize
|
// TODO: localize
|
||||||
|
|
|
@ -926,19 +926,43 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServer = function (callback) {
|
||||||
case 200:
|
case 200:
|
||||||
case 201:
|
case 201:
|
||||||
case 204:
|
case 204:
|
||||||
// Delete test file
|
Zotero.Utilities.HTTP.doHead(
|
||||||
Zotero.Utilities.HTTP.WebDAV.doDelete(
|
|
||||||
testFileURI,
|
testFileURI,
|
||||||
function (req) {
|
function (req) {
|
||||||
Zotero.debug(req.responseText);
|
Zotero.debug(req.responseText);
|
||||||
Zotero.debug(req.status);
|
Zotero.debug(req.status);
|
||||||
|
|
||||||
switch (req.status) {
|
switch (req.status) {
|
||||||
case 200: // IIS 5.1 and Sakai return 200
|
case 200:
|
||||||
case 204:
|
// Delete test file
|
||||||
callback(
|
Zotero.Utilities.HTTP.WebDAV.doDelete(
|
||||||
uri,
|
testFileURI,
|
||||||
Zotero.Sync.Storage.SUCCESS
|
function (req) {
|
||||||
|
Zotero.debug(req.responseText);
|
||||||
|
Zotero.debug(req.status);
|
||||||
|
|
||||||
|
switch (req.status) {
|
||||||
|
case 200: // IIS 5.1 and Sakai return 200
|
||||||
|
case 204:
|
||||||
|
callback(
|
||||||
|
uri,
|
||||||
|
Zotero.Sync.Storage.SUCCESS
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 401:
|
||||||
|
callback(uri, Zotero.Sync.Storage.ERROR_AUTH_FAILED);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 403:
|
||||||
|
callback(uri, Zotero.Sync.Storage.ERROR_FORBIDDEN);
|
||||||
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
|
callback(uri, Zotero.Sync.Storage.ERROR_UNKNOWN);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -950,6 +974,16 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServer = function (callback) {
|
||||||
callback(uri, Zotero.Sync.Storage.ERROR_FORBIDDEN);
|
callback(uri, Zotero.Sync.Storage.ERROR_FORBIDDEN);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// IIS 6+ configured not to serve extensionless files or .prop files
|
||||||
|
// http://support.microsoft.com/kb/326965
|
||||||
|
case 404:
|
||||||
|
callback(uri, Zotero.Sync.Storage.ERROR_FILE_MISSING_AFTER_UPLOAD);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 500:
|
||||||
|
callback(uri, Zotero.Sync.Storage.ERROR_SERVER_ERROR);
|
||||||
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
callback(uri, Zotero.Sync.Storage.ERROR_UNKNOWN);
|
callback(uri, Zotero.Sync.Storage.ERROR_UNKNOWN);
|
||||||
return;
|
return;
|
||||||
|
@ -1167,6 +1201,20 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServerCallback = function (uri
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
case Zotero.Sync.Storage.ERROR_FILE_MISSING_AFTER_UPLOAD:
|
||||||
|
// TODO: localize
|
||||||
|
var errorTitle = "WebDAV Server Configuration Error";
|
||||||
|
var errorMessage = "Your WebDAV server must be configured to serve files without extensions "
|
||||||
|
+ "and files with .prop extensions in order to work with Zotero.";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Zotero.Sync.Storage.ERROR_SERVER_ERROR:
|
||||||
|
// TODO: localize
|
||||||
|
var errorTitle = "WebDAV Server Configuration Error";
|
||||||
|
var errorMessage = "Your WebDAV server returned an internal error."
|
||||||
|
+ "\n\n" + Zotero.getString('sync.storage.error.checkFileSyncSettings');
|
||||||
|
break;
|
||||||
|
|
||||||
case Zotero.Sync.Storage.ERROR_UNKNOWN:
|
case Zotero.Sync.Storage.ERROR_UNKNOWN:
|
||||||
var errorMessage = Zotero.localeJoin([
|
var errorMessage = Zotero.localeJoin([
|
||||||
Zotero.getString('general.unknownErrorOccurred'),
|
Zotero.getString('general.unknownErrorOccurred'),
|
||||||
|
|
Loading…
Reference in a new issue