<commit_before>var express  = require('express');
var router   = express.Router();
var app      = require('../app.js');

var types = {css: 'text/css', js: 'application/javascript'};
var pattern = /^[a-z0-9]{32}\\.(css|js)$/;

router.get('/static/:path(*)', function(req, res) {

    if (pattern.test(req.params.path)) {
        var md5 = req.params.path.substr(0, 32);
        var type = req.params.path.substr(33);
        var compiled = app.get(type);
        if (compiled.md5 === md5) {
            res.set('Content-Type', types[type]);
            res.set('Cache-Control', 'public, max-age=31536000'); // A year.
            res.set('Expires', new Date(Date.now() + 31536000000).toUTCString());
            res.send(compiled.code);
            return;
        }
    }

    res.send(404, 'Not found!');
});

module.exports = router;<commit_msg>Fixes to the static route.<commit_after>var express  = require('express');
var router   = express.Router();
var app      = require('../app.js');

var types = {css: 'text/css', js: 'application/javascript'};
var pattern = /^[a-f0-9]{32}\.(css|js)$/;

router.get('/static/:path(*)', function(req, res) {
    if (pattern.test(req.params.path)) {
        var md5 = req.params.path.substr(0, 32);
        var type = req.params.path.substr(33);
        var compiled = app.get(type);
        if (compiled.md5 === md5) {
            res.contentType(types[type]);
            res.set('Cache-Control', 'public, max-age=31536000'); // A year.
            res.set('Expires', new Date(Date.now() + 31536000000).toUTCString());
            res.send(compiled.code);
            return;
        }
    }

    res.status(404).send('Not found!');
});

module.exports = router;
{'fraction_non_alphanumeric': 0.19718309859154928, 'fraction_numerical': 0.03990610328638498, 'mean_word_length': 2.5520833333333335, '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': '5956712', 'n_tokens_mistral': 609, 'n_tokens_neox': 560, 'n_words': 109}