1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-27 20:45:15 +00:00

Make sure all "get" access to $tw.config.fileExtensionInfo goes through a $tw.utils.getFileExtensionInfo helper function that ensures the parameter is cast to lowercase. Fixes #1418.

This commit is contained in:
Jim Lehmer
2015-02-01 12:33:40 -06:00
parent 2db6cbed2d
commit 8cd0c2afcd
3 changed files with 16 additions and 8 deletions

View File

@@ -761,8 +761,8 @@ exports.old_parseText = function(type,text,options) {
options = options || {};
// Select a parser
var Parser = $tw.Wiki.parsers[type];
if(!Parser && $tw.config.fileExtensionInfo[type]) {
Parser = $tw.Wiki.parsers[$tw.config.fileExtensionInfo[type].type];
if(!Parser && $tw.utils.getFileExtensionInfo(type)) {
Parser = $tw.Wiki.parsers[$tw.utils.getFileExtensionInfo(type).type];
}
if(!Parser) {
Parser = $tw.Wiki.parsers[options.defaultType || "text/vnd.tiddlywiki"];
@@ -1104,7 +1104,7 @@ exports.readFile = function(file,callback) {
if(type === "" || !type) {
var dotPos = file.name.lastIndexOf(".");
if(dotPos !== -1) {
var fileExtensionInfo = $tw.config.fileExtensionInfo[file.name.substr(dotPos)];
var fileExtensionInfo = $tw.utils.getFileExtensionInfo(file.name.substr(dotPos));
if(fileExtensionInfo) {
type = fileExtensionInfo.type;
}