<commit_before>"use strict";
var secrets = require('../secrets.json');
var express = require('express');
var router = express.Router();
var request = require('request');
var common = require('../services/common.js');

router.get(['/database', '/database/*'], function(req, res, next) {
    if(!common.isAdmin(req.session.user && req.session.user.email)) return next();
    req.pipe(request(getUrl(req.url))).pipe(res);
});

function getUrl(url) {
    //Path.join is not working with request.pipe. So this hack for removing the extra / in the secrets.db
    return secrets.db.replace(/\/$/, '') + url.replace(/^\/database/, '');
}

module.exports = router;<commit_msg>Bug fix<commit_after>"use strict";
var secrets = require('../secrets.json');
var express = require('express');
var router = express.Router();
var request = require('request');
var common = require('../services/common.js');

router.get('/_utils/*', function(req, res, next) {
    if(!common.isAdmin(req.session.user && req.session.user.email)) return next();
    req.pipe(request(getUrl(req.url))).pipe(res);
});

function getUrl(url) {
    //Path.join is not working with request.pipe. So this hack for removing the extra / in the secrets.db
    return secrets.db.replace(/\/$/, '') + url;
}

module.exports = router;
{'fraction_non_alphanumeric': 0.1939252336448598, 'fraction_numerical': 0.0, 'mean_word_length': 4.266393442622951, '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': '6843013', 'n_tokens_mistral': 394, 'n_tokens_neox': 387, 'n_words': 99}