mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
Updated code to reflect js-yaml dependency changes
no issue - as per https://github.com/nodeca/js-yaml/blob/master/migrate_v3_to_v4.md, `safeLoad` is now `load` and safe by default, so we can just switch to that
This commit is contained in:
parent
33c4d0030d
commit
8e05a375ad
4 changed files with 6 additions and 6 deletions
|
@ -58,9 +58,9 @@ const parseRedirectsFile = (content, ext) => {
|
|||
|
||||
if (ext === '.yaml') {
|
||||
let redirects = [];
|
||||
let configYaml = yaml.safeLoad(content);
|
||||
let configYaml = yaml.load(content);
|
||||
|
||||
// yaml.safeLoad passes almost every yaml code.
|
||||
// yaml.load passes almost every yaml code.
|
||||
// Because of that, it's hard to detect if there's an error in the file.
|
||||
// But one of the obvious errors is the plain string output.
|
||||
// Here we check if the user made this mistake.
|
||||
|
|
|
@ -11,7 +11,7 @@ const errors = require('@tryghost/errors');
|
|||
*/
|
||||
module.exports = function parseYaml(file, fileName) {
|
||||
try {
|
||||
const parsed = yaml.safeLoad(file);
|
||||
const parsed = yaml.load(file);
|
||||
|
||||
debug('YAML settings file parsed:', fileName);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ describe('DB version integrity', function () {
|
|||
// and the values above will need updating as confirmation
|
||||
it('should not change without fixing this test', function () {
|
||||
const routesPath = path.join(config.get('paths').defaultSettings, 'default-routes.yaml');
|
||||
const defaultRoutes = validateFrontendSettings(yaml.safeLoad(fs.readFileSync(routesPath, 'utf-8')));
|
||||
const defaultRoutes = validateFrontendSettings(yaml.load(fs.readFileSync(routesPath, 'utf-8')));
|
||||
|
||||
const tablesNoValidation = _.cloneDeep(schema.tables);
|
||||
let schemaHash;
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('UNIT > Settings Service yaml parser:', function () {
|
|||
let yamlSpy;
|
||||
|
||||
beforeEach(function () {
|
||||
yamlSpy = sinon.spy(yaml, 'safeLoad');
|
||||
yamlSpy = sinon.spy(yaml, 'load');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
|
@ -35,7 +35,7 @@ describe('UNIT > Settings Service yaml parser:', function () {
|
|||
} catch (error) {
|
||||
should.exist(error);
|
||||
error.message.should.eql('Could not parse badroutes.yaml: bad indentation of a mapping entry.');
|
||||
error.context.should.containEql('bad indentation of a mapping entry at line 5, column 14');
|
||||
error.context.should.containEql('bad indentation of a mapping entry (5:14)');
|
||||
error.help.should.eql('Check your badroutes.yaml file for typos and fix the named issues.');
|
||||
yamlSpy.calledOnce.should.be.true();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue