www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 7e1a678f9b7692cc7f14167d8aabf3e18806a2ae
parent 794238c23f88964908696226a115eab44ed12168
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 12 Aug 2006 03:54:13 +0000

Addresses #136, Detect mime type and character set of local files when importing

Use new MIME type detection tricks when linking and importing files -- now for charset detection...


Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/data_access.js | 13++-----------
1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -1950,7 +1950,7 @@ Scholar.Attachments = new function(){ newFile.initWithFile(destDir); newFile.append(title); - var mimeType = _getMIMETypeFromFile(newFile); + var mimeType = Scholar.File.getMIMETypeFromFile(newFile); var charsetID = _getCharsetIDFromFile(newFile); _addToDB(newFile, null, null, this.LINK_MODE_IMPORTED_FILE, mimeType, charsetID, sourceItemID, itemID); @@ -1961,7 +1961,7 @@ Scholar.Attachments = new function(){ function linkFromFile(file, sourceItemID){ var title = file.leafName; - var mimeType = _getMIMETypeFromFile(file); + var mimeType = Scholar.File.getMIMETypeFromFile(file); var charsetID = _getCharsetIDFromFile(file); return _addToDB(file, null, title, this.LINK_MODE_LINKED_FILE, mimeType, charsetID, sourceItemID); } @@ -2050,15 +2050,6 @@ Scholar.Attachments = new function(){ } - // TODO: currently only uses file extension - function _getMIMETypeFromFile(file){ - var ms = Components - .classes['@mozilla.org/uriloader/external-helper-app-service;1'] - .getService(Components.interfaces.nsIMIMEService); - return ms.getTypeFromFile(file); - } - - function _getCharsetIDFromFile(file){ // TODO: Not yet implemented return null;