<commit_before>'use strict';

var path = require('path'),
  os = require('os'),
  outputDir = os.tmpdir(),
  cheerio = require('cheerio'),
  config = require(path.join(__dirname, '../config')),
  util = require('util'),
  Q = require('q'),
  fs = require('fs-extra'),
  pwa10 = require('pwabuilder-windows10');

exports.create = function (client, storage, pwabuilder, raygun) {
  pwa10.Platform(); // Initialize PWA Windows 10 Builder Lib

  return {
    show: function (req, res, next) {
      client.get(req.params.id, function (err, reply) {
        if (err) return next(err);
        if (!reply) return res.status(404).send('NOT FOUND');

        var manifest = JSON.parse(reply);
        res.json(manifest);
      });
    },
    create: function (req, res, next) {
      if (req.body.siteUrl) {
        pwabuilder
          .createManifestFromUrl(req.body.siteUrl, client)
          .then(function (manifest) {
            res.json(manifest);
          })
          .fail(function (err) {
            return res.status(422).json({ error: err.message });
          });
      } else if (req.body.manifest) {
        pwabuilder
          .uploadManifest(req.body.manifest, client)
          .then(function (manifest) {
            res.json(manifest);
          })
          .fail(function (err) {
            return res.status().json({ error: err.message });
          })
      } else if (req.files && req.files[0]) {
        var file = req.files[0];<commit_msg>change line to read the payload correctly<commit_after>'use strict';

var path = require('path'),
  os = require('os'),
  outputDir = os.tmpdir(),
  cheerio = require('cheerio'),
  config = require(path.join(__dirname, '../config')),
  util = require('util'),
  Q = require('q'),
  fs = require('fs-extra'),
  pwa10 = require('pwabuilder-windows10');

exports.create = function (client, storage, pwabuilder, raygun) {
  pwa10.Platform(); // Initialize PWA Windows 10 Builder Lib

  return {
    show: function (req, res, next) {
      client.get(req.params.id, function (err, reply) {
        if (err) return next(err);
        if (!reply) return res.status(404).send('NOT FOUND');

        var manifest = JSON.parse(reply);
        res.json(manifest);
      });
    },
    create: function (req, res, next) {
      if (req.body.siteUrl) {
        pwabuilder
          .createManifestFromUrl(req.body.siteUrl, client)
          .then(function (manifest) {
            res.json(manifest);
          })
          .fail(function (err) {
            return res.status(422).json({ error: err.message });
          });
      } else if (req.body.content && req.body.format === "w3c") {
        pwabuilder
          .uploadManifest(req.body.manifest, client)
          .then(function (manifest) {
            res.json(manifest);
          })
          .fail(function (err) {
            return res.status().json({ error: err.message });
          })
      } else if (req.files && req.files[0]) {
        var file = req.files[0];
{'fraction_non_alphanumeric': 0.15851206434316353, 'fraction_numerical': 0.011058981233243968, 'mean_word_length': 2.291069459757442, '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': '898522', 'n_tokens_mistral': 939, 'n_tokens_neox': 913, 'n_words': 205}