<commit_before>var request = require('request');


module.exports = {

  provider: true,
 
  proxy: function(req, res){
    /*function send( err, data ){
        if ( err ){
          res.json( err, 500 );
        } else { 
          if ( data ){
            res.json( data );
          } else {
            res.send('There a problem accessing this overlay', 500);
          }
        }
    };
    if ( req.params.id ){
      var id = req.params.id;
      var d = {};
      FeatureServiceProxy.find( id, req.query, function( err, data) {
        if (req.params.layer !== undefined && data[req.params.layer]){
          //d = data[req.params.layer];
          send( err, data[req.params.layer] );
        } else if ( !req.params.layer ) {
          send( err, data );
        } else {
          send( 'Layer not found', null);
        }
      });
    } else {
    }*/
    if (!req.query || !req.query.url ){ 
      res.send('Must specifiy a url', 500);
    } else {
      // get featureservice data
      console.log('Proxy', req.query.url );
      var url = req.query.url;
      delete req.query.url;
      FeatureServiceProxy.proxy( url, req.query, function(err, json){
        if (err) {
          res.send(err, 500);
        } else {
          res.json( json );
        }
      });
    }
  },

  thumbnail: function(req, res){
    if (!req.query || !req.query.url ){ 
      res.send('Must specifiy a url', 500);
    } else {
      console.log('Thumbnail', req.query.url);
      var url = req.query.url;
      delete req.query.url;
      FeatureServiceProxy.thumbnail( url, req.query, function(err, file){
        if (err) {
          res.send(err, 500);
        } else {
          console.log('send file', file);
          res.sendfile( file );
        }
      });
    }
  }


};<commit_msg>replacing the ? in feature service proxies<commit_after>var request = require('request');


module.exports = {

  provider: true,
 
  proxy: function(req, res){
    /*function send( err, data ){
        if ( err ){
          res.json( err, 500 );
        } else { 
          if ( data ){
            res.json( data );
          } else {
            res.send('There a problem accessing this overlay', 500);
          }
        }
    };
    if ( req.params.id ){
      var id = req.params.id;
      var d = {};
      FeatureServiceProxy.find( id, req.query, function( err, data) {
        if (req.params.layer !== undefined && data[req.params.layer]){
          //d = data[req.params.layer];
          send( err, data[req.params.layer] );
        } else if ( !req.params.layer ) {
          send( err, data );
        } else {
          send( 'Layer not found', null);
        }
      });
    } else {
    }*/
    if (!req.query || !req.query.url ){ 
      res.send('Must specifiy a url', 500);
    } else {
      // get featureservice data
      var url = req.query.url.replace('?','&');
      delete req.query.url;
      FeatureServiceProxy.proxy( url, req.query, function(err, json){
        if (err) {
          res.send(err, 500);
        } else {
          res.json( json );
        }
      });
    }
  },

  thumbnail: function(req, res){
    if (!req.query || !req.query.url ){ 
      res.send('Must specifiy a url', 500);
    } else {
      var url = req.query.url.replace('?','&');
      delete req.query.url;
      FeatureServiceProxy.thumbnail( url, req.query, function(err, file){
        if (err) {
          res.send(err, 500);
        } else {
          console.log('send file', file);
          res.sendfile( file );
        }
      });
    }
  }


};
{'fraction_non_alphanumeric': 0.15814606741573034, 'fraction_numerical': 0.010112359550561797, 'mean_word_length': 1.6456166419019316, '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': '4256676', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1110, 'n_words': 263}