Display helpful error when trying to sync files with invalid characters in their filenames

This commit is contained in:
Dan Stillman 2010-02-02 13:00:21 +00:00
parent e8e03f9e62
commit c22b063d1d

View file

@ -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 = <path>{item.attachment.path}</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>{path}</path>;
xml.path += path;
// Include storage sync time and hash for imported files