Sceure/logging/outside fixes

This commit is contained in:
Sean Lilley 2018-10-31 23:00:22 -04:00
parent 099d6ee65e
commit 9fc526b692
1 changed files with 3 additions and 3 deletions

View File

@ -481,14 +481,14 @@ function loadMaterials(mtlPaths, objPath, options) {
var shallowPath = path.join(objDirectory, path.basename(mtlPath)); var shallowPath = path.join(objDirectory, path.basename(mtlPath));
if (options.secure && outsideDirectory(mtlPath, objPath)) { if (options.secure && outsideDirectory(mtlPath, objPath)) {
// Try looking for the .mtl in the same directory as the obj // Try looking for the .mtl in the same directory as the obj
optionslogger('The material file is outside of the obj directory and the secure flag is true. Attempting to read the material file from within the obj directory instead.'); options.logger('The material file is outside of the obj directory and the secure flag is true. Attempting to read the material file from within the obj directory instead.');
return loadMtl(shallowPath) return loadMtl(shallowPath)
.then(function(materialsInMtl) { .then(function(materialsInMtl) {
Object.assign(materials, materialsInMtl); Object.assign(materials, materialsInMtl);
}) })
.catch(function(error) { .catch(function(error) {
console.logger(error.message); options.logger(error.message);
console.logger('Could not read material file at ' + shallowPath + '. Using default material instead.'); options.logger('Could not read material file at ' + shallowPath + '. Using default material instead.');
}); });
} }
return loadMtl(mtlPath) return loadMtl(mtlPath)