commit f5d383a91eb09436076b967fe9c1c16b2ae1987d
parent b7db38d946393b7c8cb42ce19fad6a6bef2e6100
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 10 Sep 2010 02:32:02 +0000
Commons:
- Check getDisplayTitle() in pre-upload title check
- Use display title for ZIP filename, and run through getValidFileName()
- Use display title in URI
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/commons.js b/chrome/content/zotero/xpcom/commons.js
@@ -771,7 +771,7 @@ Zotero.Commons.Bucket.prototype.uploadItems = function (ids) {
for (var i=0, len=items.length; i<len; i++) {
if (items[i].isRegularItem()) {
// Item must have a title
- if (!items[i].getField('title')) {
+ if (!items[i].getDisplayTitle()) {
continue;
}
@@ -858,7 +858,7 @@ Zotero.Commons.Bucket.prototype.uploadItems = function (ids) {
// TODO: localize
progressWin.changeHeadline("Uploading Items to IA");
- progressWin.addLines([item.getField('title')], [item.getImageSrc()]);
+ progressWin.addLines([item.getDisplayTitle()], [item.getImageSrc()]);
progressWin.show();
self.uploadItem(
@@ -909,7 +909,8 @@ Zotero.Commons.Bucket.prototype.uploadItem = function (item, callback) {
// Then create ZIP file from item
var zipFile = Zotero.getTempDirectory();
- zipFile.append(item.getField('title') + '-' + key + '.zip');
+ var title = Zotero.File.getValidFileName(item.getDisplayTitle());
+ zipFile.append(title + '-' + key + '.zip');
var zw = Components.classes["@mozilla.org/zipwriter;1"]
.createInstance(Components.interfaces.nsIZipWriter);
@@ -1150,7 +1151,8 @@ Zotero.Commons.Bucket.prototype.putFile = function (file, mimeType, callback) {
Zotero.Commons.Bucket.prototype.getItemURI = function (item) {
- return this.uri + '#' + encodeURIComponent(item.getField('title'));
+ // TODO: this won't work for non-English systems
+ return this.uri + '#' + encodeURIComponent(item.getDisplayTitle());
}