From c22b063d1d93ce89712a68b50f657bc40abc6bdf Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 2 Feb 2010 13:00:21 +0000 Subject: [PATCH] Display helpful error when trying to sync files with invalid characters in their filenames --- chrome/content/zotero/xpcom/sync.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 11a00cdc6..a2e0d664b 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -3377,7 +3377,17 @@ Zotero.Sync.Server.Data = new function() { if (item.attachment.linkMode != Zotero.Attachments.LINK_MODE_LINKED_URL) { // Include paths for non-links - var path = {item.attachment.path}; + var path = item.attachment.path; + if (path != _xmlize(path)) { + var filename = item.attachment.path.substr(8); + // TODO: localize + var msg = "The filename '" + filename + "' contains invalid characters.\n\nRename the file and try again. " + + "If you rename the file via the OS, you will need to relink it in Zotero."; + var e = new Zotero.Error(msg, 0, { dialogButtonText: null }); + throw (e); + + } + path = {path}; xml.path += path; // Include storage sync time and hash for imported files