diff options
Diffstat (limited to 'services/sync/modules/service.js')
-rw-r--r-- | services/sync/modules/service.js | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 5b97fcca39..f8c64b0fad 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -1067,33 +1067,34 @@ Sync11Service.prototype = { // Note: returns false if we failed for a reason other than the server not yet // supporting the api. _fetchServerConfiguration() { -#if 0 // FSyncMS doesn't support this and it will break auth if left enabled! - // This is similar to _fetchInfo, but with different error handling. + if (Svc.Prefs.get("APILevel") >= 2) { + // This is similar to _fetchInfo, but with different error handling. + // Only supported by later sync implementations. - let infoURL = this.userBaseURL + "info/configuration"; - this._log.debug("Fetching server configuration", infoURL); - let configResponse; - try { - configResponse = this.resource(infoURL).get(); - } catch (ex) { - // This is probably a network or similar error. - this._log.warn("Failed to fetch info/configuration", ex); - this.errorHandler.checkServerError(ex); - return false; - } + let infoURL = this.userBaseURL + "info/configuration"; + this._log.debug("Fetching server configuration", infoURL); + let configResponse; + try { + configResponse = this.resource(infoURL).get(); + } catch (ex) { + // This is probably a network or similar error. + this._log.warn("Failed to fetch info/configuration", ex); + this.errorHandler.checkServerError(ex); + return false; + } - if (configResponse.status == 404) { - // This server doesn't support the URL yet - that's OK. - this._log.debug("info/configuration returned 404 - using default upload semantics"); - } else if (configResponse.status != 200) { - this._log.warn(`info/configuration returned ${configResponse.status} - using default configuration`); - this.errorHandler.checkServerError(configResponse); - return false; - } else { - this.serverConfiguration = configResponse.obj; + if (configResponse.status == 404) { + // This server doesn't support the URL yet - that's OK. + this._log.debug("info/configuration returned 404 - using default upload semantics"); + } else if (configResponse.status != 200) { + this._log.warn(`info/configuration returned ${configResponse.status} - using default configuration`); + this.errorHandler.checkServerError(configResponse); + return false; + } else { + this.serverConfiguration = configResponse.obj; + } + this._log.trace("info/configuration for this server", this.serverConfiguration); } - this._log.trace("info/configuration for this server", this.serverConfiguration); -#endif return true; }, |