Skip to content

Commit

Permalink
Escapes the URL before adding document
Browse files Browse the repository at this point in the history
Signed-off-by: Antoine Chabert <[email protected]>
  • Loading branch information
antitoine committed Mar 20, 2019
1 parent bf9c71b commit a570b31
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var jsonist = require('jsonist')
var template = require('lodash').template
var once = require('lodash').once
var remove_meta = require('ndjson-to-elasticsearch/lib/remove-meta')
var querystring = require("querystring")

module.exports = function (config, log, since) {
var _retry = async.retry.bind(null, config.retry)
Expand Down Expand Up @@ -59,7 +60,7 @@ module.exports = function (config, log, since) {
if (change.id.indexOf('_design') === 0) return endTask()

var doc = change.doc
var es_doc_url = config.elasticsearch + '/' + change.id
var es_doc_url = config.elasticsearch + '/' + querystring.escape(change.id)
if (config.key) es_doc_url = config.elasticsearch + '/' + doc[config.key]
if (config.urlTemplate) es_doc_url = run_compile(es_doc_url, doc, log)
if (doc._deleted) return handle_delete(config, es_doc_url, change, log, onDone, endTask)
Expand Down

0 comments on commit a570b31

Please sign in to comment.