Skip to content

Commit

Permalink
Make sure translator file ends with newline when saving
Browse files Browse the repository at this point in the history
  • Loading branch information
dstillman committed Jan 23, 2017
1 parent c9694e9 commit cddc84f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions chrome/content/zotero/xpcom/translation/translators.js
Expand Up @@ -475,8 +475,12 @@ Zotero.Translators = new function() {
// JSON.stringify has the benefit of indenting JSON
var metadataJSON = JSON.stringify(metadata, null, "\t");

var str = metadataJSON + "\n\n" + code,
translator;
var str = metadataJSON + "\n\n" + code;

// Make sure file ends with newline
if (!str.endsWith('\n')) {
str += '\n';
}

var translator = Zotero.Translators.get(metadata.translatorID);
var sameFile = translator && destFile == translator.path;
Expand Down

0 comments on commit cddc84f

Please sign in to comment.