commit 259c286db7c7e56728be5f576793b9aea81f843c
parent 0256f5b9807880af5b9816c61d5641e87f1d9c26
Author: Simon Kornblith <simon@simonster.com>
Date: Mon, 17 Jan 2011 07:42:22 +0000
- fix export when dataMode is undefined (translate architecture should assume plain text)
- don't use "null" as a file extension
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js
@@ -65,9 +65,9 @@ Zotero_File_Exporter.prototype.save = function() {
fp.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
} else {
// if the result will be a file, append an extension and use filters
- fp.defaultString = this.name+"."+io.selectedTranslator.target;
+ fp.defaultString = this.name+(io.selectedTranslator.target ? "."+io.selectedTranslator.target : "");
fp.defaultExtension = io.selectedTranslator.target;
- fp.appendFilter(io.selectedTranslator.label, "*."+io.selectedTranslator.target);
+ fp.appendFilter(io.selectedTranslator.label, "*."+(io.selectedTranslator.target ? io.selectedTranslator.target : "*"));
}
var rv = fp.show();
diff --git a/chrome/content/zotero/xpcom/translation/browser_firefox.js b/chrome/content/zotero/xpcom/translation/browser_firefox.js
@@ -84,6 +84,7 @@ Zotero.Translate.SandboxManager.prototype = {
return object[localKey].apply(object, args);
};
+ attachTo[localKey].name = localKey;
// attach members
if(!(object instanceof Components.interfaces.nsISupports)) {
@@ -347,7 +348,7 @@ Zotero.Translate.IO.Write = function(file, mode, charset) {
.createInstance(Components.interfaces.nsIFileOutputStream);
this._rawStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate
this._writtenToStream = false;
- if(mode) this.reset(mode, charset);
+ if(mode || charset) this.reset(mode, charset);
}
Zotero.Translate.IO.Write.prototype = {
@@ -372,6 +373,8 @@ Zotero.Translate.IO.Write.prototype = {
},
"write":function(data) {
+ if(!this._charset) this.setCharacterSet("UTF-8");
+
if(!this._writtenToStream && this._charset.substr(this._charset.length-4) == "xBOM"
&& BOMs[this._charset.substr(0, this._charset.length-4).toUpperCase()]) {
// If stream has not yet been written to, and a UTF type has been selected, write BOM