<commit_before>const Router = require('../../Router');

const router = new Router();

const libraryMapping = require('../../assets/mapping.json');

router.get('/ping', (req, res) => {
  res.status(204);
  res.end();
});

router.get('/ping-no-cache', (req, res) => {
  res.status(204);
  res.end();
});

router.get('/:folder', (req, res, next) => {
  let folder = req.params.folder;
  if (folder in libraryMapping) folder = libraryMapping[folder];
  return res.redirect(302, `/v2/${folder}`, next);
});

router.get('/:folder/:version', (req, res, next) => {
  let folder = req.params.folder;
  if (folder in libraryMapping) folder = libraryMapping[folder];
  return res.redirect(302, `/v2/${folder}?v=${req.params.version}`, next);
});

module.exports = router;<commit_msg>Change redirects to 301<commit_after>const Router = require('../../Router');

const router = new Router();

const libraryMapping = require('../../assets/mapping.json');

router.get('/ping', (req, res) => {
  res.status(204);
  res.end();
});

router.get('/ping-no-cache', (req, res) => {
  res.status(204);
  res.end();
});

router.get('/:folder', (req, res, next) => {
  let folder = req.params.folder;
  if (folder in libraryMapping) folder = libraryMapping[folder];
  return res.redirect(301, `/v2/${folder}`, next);
});

router.get('/:folder/:version', (req, res, next) => {
  let folder = req.params.folder;
  if (folder in libraryMapping) folder = libraryMapping[folder];
  return res.redirect(301, `/v2/${folder}?v=${req.params.version}`, next);
});

module.exports = router;
{'fraction_non_alphanumeric': 0.22265122265122264, 'fraction_numerical': 0.019948519948519948, 'mean_word_length': 4.325342465753424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2051969', 'n_tokens_mistral': 540, 'n_tokens_neox': 523, 'n_words': 114}