diff --git a/chrome/content/zotero/xpcom/dataDirectory.js b/chrome/content/zotero/xpcom/dataDirectory.js index e38f6fd85e..8fd02f7c39 100644 --- a/chrome/content/zotero/xpcom/dataDirectory.js +++ b/chrome/content/zotero/xpcom/dataDirectory.js @@ -491,11 +491,15 @@ Zotero.DataDirectory = { continue; } - // In dropbox folder - if (Zotero.File.isDropboxDirectory(file.path)) { + // In a cloud storage folder (Dropbox, etc.) + if (Zotero.File.isCloudStorageFolder(file.path)) { dialogTitle = Zotero.getString('general.warning'); - dialogText = Zotero.getString('dataDir.unsafeLocation.selected.dropbox') + "\n\n" - + Zotero.getString('dataDir.unsafeLocation.selected.useAnyway'); + dialogText = Zotero.getString('dataDir.unsafeLocation.selected.cloud') + "\n\n" + + file.path + "\n\n" + + Zotero.getString('dataDir.unsafeLocation.selected.areYouSure'); + moreInfoCallback = () => { + Zotero.launchURL('https://www.zotero.org/support/kb/data_directory_in_cloud_storage_folder'); + }; } else if (file.directoryEntries.hasMoreElements()) { let dbfile = file.clone(); @@ -605,17 +609,24 @@ Zotero.DataDirectory = { checkForUnsafeLocation: Zotero.Promise.coroutine(function* (path) { - if (this._warnOnUnsafeLocation && Zotero.File.isDropboxDirectory(path) - && Zotero.Prefs.get('warnOnUnsafeDataDir')) { + if (!this._warnOnUnsafeLocation || !Zotero.Prefs.get('warnOnUnsafeDataDir')) { + return; + } + + if (Zotero.File.isCloudStorageFolder(path)) { this._warnOnUnsafeLocation = false; let check = {value: false}; + let ps = Services.prompt; let index = Services.prompt.confirmEx( null, Zotero.getString('general.warning'), - Zotero.getString('dataDir.unsafeLocation.existing.dropbox') + "\n\n" + Zotero.getString('dataDir.unsafeLocation.existing.cloud', Zotero.appName) + "\n\n" + + path + "\n\n" + Zotero.getString('dataDir.unsafeLocation.existing.chooseDifferent'), - Services.prompt.STD_YES_NO_BUTTONS, - null, null, null, + ps.STD_YES_NO_BUTTONS + + ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING, + null, null, + Zotero.getString('general.moreInformation'), Zotero.getString('general.dontShowWarningAgain'), check ); @@ -624,6 +635,9 @@ Zotero.DataDirectory = { if (index == 0) { yield this.choose(true); } + else if (index == 2) { + Zotero.launchURL('https://www.zotero.org/support/kb/data_directory_in_cloud_storage_folder'); + } if (check.value) { Zotero.Prefs.set('warnOnUnsafeDataDir', false); } diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index e111172bb8..753e26c753 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -1346,8 +1346,25 @@ Zotero.File = new function(){ }; + this.isCloudStorageFolder = function (path) { + return this.isDropboxDirectory(path) + || this.isGoogleDriveDirectory(path) + || this.isOneDriveDirectory(path); + }; + + this.isDropboxDirectory = function(path) { - return path.toLowerCase().indexOf('dropbox') != -1; + return path.toLowerCase().includes('dropbox'); + } + + + this.isGoogleDriveDirectory = function(path) { + return path.includes('Google Drive'); + } + + + this.isOneDriveDirectory = function(path) { + return path.toLowerCase().includes('onedrive'); } diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index dea7b66ce3..5cf4f73ae8 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -153,9 +153,9 @@ dataDir.changeDataDirectory = Change Data Directory… dataDir.chooseNewDataDirectory = Choose New Data Directory… dataDir.cannotBeSetWithAlternative = The data directory cannot be set to a “storage” directory. Did you mean %S? dataDir.cannotBeLinkedAttachmentBaseDirectory = The data directory cannot be set to the same location as the Linked Attachment Base Directory. -dataDir.unsafeLocation.selected.dropbox = Choosing a data directory within Dropbox may corrupt your database. -dataDir.unsafeLocation.selected.useAnyway = Use this directory anyway? -dataDir.unsafeLocation.existing.dropbox = Your Zotero data directory is within Dropbox, which may lead to data corruption. +dataDir.unsafeLocation.selected.cloud = Storing the data directory in a cloud storage folder is very likely to corrupt your database. +dataDir.unsafeLocation.selected.areYouSure = Are you sure you want to use this location? +dataDir.unsafeLocation.existing.cloud = Your %S data directory appears to be within a cloud storage folder, which is very likely to corrupt your database. dataDir.unsafeLocation.existing.chooseDifferent = Would you like to choose a different location now? dataDir.selectedDirNonEmpty.title = Directory Not Empty dataDir.selectedDirNonEmpty.text = The directory you selected is not empty and does not appear to be a Zotero data directory.\n\nCreate Zotero files in this directory anyway?