Chef now defaults to treat as UTF8 if option is not set

This commit is contained in:
n1474335 2018-01-06 16:21:42 +00:00
parent 28c83fa921
commit f53e7ad617
2 changed files with 6 additions and 5 deletions

View File

@ -35,10 +35,11 @@ const Chef = function() {
*/ */
Chef.prototype.bake = async function(input, recipeConfig, options, progress, step) { Chef.prototype.bake = async function(input, recipeConfig, options, progress, step) {
log.debug("Chef baking"); log.debug("Chef baking");
let startTime = new Date().getTime(), const startTime = new Date().getTime(),
recipe = new Recipe(recipeConfig), recipe = new Recipe(recipeConfig),
containsFc = recipe.containsFlowControl(), containsFc = recipe.containsFlowControl(),
error = false; notUTF8 = options && options.hasOwnProperty("treatAsUtf8") && !options.treatAsUtf8;
let error = false;
if (containsFc && ENVIRONMENT_IS_WORKER()) self.setOption("attemptHighlight", false); if (containsFc && ENVIRONMENT_IS_WORKER()) self.setOption("attemptHighlight", false);
@ -85,8 +86,8 @@ Chef.prototype.bake = async function(input, recipeConfig, options, progress, ste
return { return {
result: this.dish.type === Dish.HTML ? result: this.dish.type === Dish.HTML ?
this.dish.get(Dish.HTML, !options.treatAsUtf8) : this.dish.get(Dish.HTML, notUTF8) :
this.dish.get(returnType, !options.treatAsUtf8), this.dish.get(returnType, notUTF8),
type: Dish.enumLookup(this.dish.type), type: Dish.enumLookup(this.dish.type),
progress: progress, progress: progress,
duration: new Date().getTime() - startTime, duration: new Date().getTime() - startTime,

View File

@ -373,7 +373,7 @@
</div> </div>
<div class="option-item"> <div class="option-item">
<input type="number" option="ioDisplayThreshold" id="ioDisplayThreshold" /> <input type="number" option="ioDisplayThreshold" id="ioDisplayThreshold" />
<label for="ioDisplayThreshold"> Size threshold for treating the input or output as a file (KiB)</label> <label for="ioDisplayThreshold"> Size threshold for treating the input and output as a file (KiB)</label>
</div> </div>
<div class="option-item"> <div class="option-item">
<select option="logLevel" id="logLevel"> <select option="logLevel" id="logLevel">