<commit_before>const _ = require('lodash');
const ghostBookshelf = require('./base');
const urlUtils = require('../../shared/url-utils');

const CustomThemeSetting = ghostBookshelf.Model.extend({
    tableName: 'custom_theme_settings',

    parse() {
        const attrs = ghostBookshelf.Model.prototype.parse.apply(this, arguments);
        const settingType = attrs.type;

        // transform "0" to false for boolean type
        if (settingType === 'boolean' && (attrs.value === '0' || attrs.value === '1')) {
            attrs.value = !!+attrs.value;
        }

        // transform "false" to false for boolean type
        if (settingType === 'boolean' && (attrs.value === 'false' || attrs.value === 'true')) {
            attrs.value = JSON.parse(attrs.value);
        }

        // transform URLs to absolute for image settings
        if (settingType === 'image' && attrs.value) {
            console.log('.parse', attrs.value, urlUtils.transformReadyToAbsolute(attrs.value));
            attrs.value = urlUtils.transformReadyToAbsolute(attrs.value);
        }

        return attrs;<commit_msg>Removed errant console.log<commit_after>const _ = require('lodash');
const ghostBookshelf = require('./base');
const urlUtils = require('../../shared/url-utils');

const CustomThemeSetting = ghostBookshelf.Model.extend({
    tableName: 'custom_theme_settings',

    parse() {
        const attrs = ghostBookshelf.Model.prototype.parse.apply(this, arguments);
        const settingType = attrs.type;

        // transform "0" to false for boolean type
        if (settingType === 'boolean' && (attrs.value === '0' || attrs.value === '1')) {
            attrs.value = !!+attrs.value;
        }

        // transform "false" to false for boolean type
        if (settingType === 'boolean' && (attrs.value === 'false' || attrs.value === 'true')) {
            attrs.value = JSON.parse(attrs.value);
        }

        // transform URLs to absolute for image settings
        if (settingType === 'image' && attrs.value) {
            attrs.value = urlUtils.transformReadyToAbsolute(attrs.value);
        }

        return attrs;
{'fraction_non_alphanumeric': 0.15077501174260216, 'fraction_numerical': 0.0028182245185533112, 'mean_word_length': 2.63481228668942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6948742', 'n_tokens_mistral': 591, 'n_tokens_neox': 576, 'n_words': 140}