kuzzle 2.27.0 → 2.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -498,23 +498,30 @@ class HttpWsProtocol extends Protocol {
498
498
  return;
499
499
  }
500
500
 
501
- const contentType = message.headers["content-type"];
501
+ const contentTypeHeader = message.headers["content-type"];
502
502
 
503
- if (
504
- contentType &&
505
- !this.httpConfig.opts.allowedContentTypes.some((allowed) =>
506
- contentType.includes(allowed)
507
- )
508
- ) {
509
- this.httpSendError(
510
- message,
511
- response,
512
- kerrorHTTP.get("unsupported_content", contentType)
513
- );
514
- return;
503
+ if (contentTypeHeader) {
504
+ const contentTypeParamIndex = contentTypeHeader.indexOf(";");
505
+ const contentType =
506
+ contentTypeParamIndex !== -1
507
+ ? contentTypeHeader.slice(0, contentTypeParamIndex).trim()
508
+ : contentTypeHeader.trim();
509
+
510
+ if (
511
+ !this.httpConfig.opts.allowedContentTypes.some(
512
+ (allowed) => contentType === allowed
513
+ )
514
+ ) {
515
+ this.httpSendError(
516
+ message,
517
+ response,
518
+ kerrorHTTP.get("unsupported_content", contentType)
519
+ );
520
+ return;
521
+ }
515
522
  }
516
523
 
517
- const encoding = CHARSET_REGEX.exec(contentType);
524
+ const encoding = CHARSET_REGEX.exec(contentTypeHeader);
518
525
 
519
526
  if (encoding !== null && encoding[1].toLowerCase() !== "utf-8") {
520
527
  this.httpSendError(
@@ -2261,8 +2261,6 @@ class ElasticSearch extends Service {
2261
2261
  reason: "document already exists",
2262
2262
  status: 400,
2263
2263
  });
2264
-
2265
- idx++;
2266
2264
  } else {
2267
2265
  esRequest.body.push({
2268
2266
  index: {
@@ -2274,6 +2272,7 @@ class ElasticSearch extends Service {
2274
2272
 
2275
2273
  toImport.push(document);
2276
2274
  }
2275
+ idx++;
2277
2276
  } else {
2278
2277
  esRequest.body.push({ index: { _index: alias } });
2279
2278
  esRequest.body.push(document._source);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.27.0",
4
+ "version": "2.27.1",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
6
  "bin": "bin/start-kuzzle-server",
7
7
  "scripts": {