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:
Dan Stillman 2010-02-13 10:10:24 +00:00
parent ca31a18159
commit e3df930ca5
2 changed files with 56 additions and 7 deletions

View file

@ -49,6 +49,7 @@ Zotero.Sync.Storage = new function () {
this.ERROR_ZOTERO_DIR_NOT_WRITABLE = -13;
this.ERROR_NOT_ALLOWED = -14;
this.ERROR_UNKNOWN = -15;
this.ERROR_FILE_MISSING_AFTER_UPLOAD = -16;
// TEMP
// TODO: localize

View file

@ -926,19 +926,43 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServer = function (callback) {
case 200:
case 201:
case 204:
// Delete test file
Zotero.Utilities.HTTP.WebDAV.doDelete(
Zotero.Utilities.HTTP.doHead(
testFileURI,
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
case 200:
// Delete test file
Zotero.Utilities.HTTP.WebDAV.doDelete(
testFileURI,
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;
@ -950,6 +974,16 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServer = function (callback) {
callback(uri, Zotero.Sync.Storage.ERROR_FORBIDDEN);
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:
callback(uri, Zotero.Sync.Storage.ERROR_UNKNOWN);
return;
@ -1167,6 +1201,20 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServerCallback = function (uri
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:
var errorMessage = Zotero.localeJoin([
Zotero.getString('general.unknownErrorOccurred'),