<commit_before>const fs = require('fs');
const { promisify } = require('util');
const { TRACKLOGS_DIR } = require('~/routers/tracklogs/constants');

const readFileAsync = promisify(fs.readFile);
const existsAsync = promisify(fs.exists);

module.exports = function attachGetTracklogHandler(router) {
  router.get('/:uid',
    async (ctx) => {
      const fileUID = ctx.params.uid;
      if (!fileUID.match(/^[a-zA-Z0-9]*$/)) {
        ctx.status = 404;
        return;
      }

      const filePath = `${TRACKLOGS_DIR}/${fileUID}.b64.gpx`;
      if (!await existsAsync(filePath)) {
        ctx.status = 404;
        return;
      }

      const b64gpx = await readFileAsync(filePath, 'utf8');

      ctx.body = {
        uid: fileUID,
        data: b64gpx,
        mediaType: 'application/gpx+xml',
      };
    },
  );
};<commit_msg>match to test<commit_after>const fs = require('fs');
const { promisify } = require('util');
const { TRACKLOGS_DIR } = require('~/routers/tracklogs/constants');

const readFileAsync = promisify(fs.readFile);
const existsAsync = promisify(fs.exists);

module.exports = function attachGetTracklogHandler(router) {
  router.get('/:uid',
    async (ctx) => {
      const fileUID = ctx.params.uid;
      if (!/^[a-zA-Z0-9]*$/.test(fileUID)) {
        ctx.status = 404;
        return;
      }

      const filePath = `${TRACKLOGS_DIR}/${fileUID}.b64.gpx`;
      if (!await existsAsync(filePath)) {
        ctx.status = 404;
        return;
      }

      const b64gpx = await readFileAsync(filePath, 'utf8');

      ctx.body = {
        uid: fileUID,
        data: b64gpx,
        mediaType: 'application/gpx+xml',
      };
    },
  );
};
{'fraction_non_alphanumeric': 0.16096096096096096, 'fraction_numerical': 0.018018018018018018, 'mean_word_length': 2.6455142231947484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4544070', 'n_tokens_mistral': 593, 'n_tokens_neox': 567, 'n_words': 102}