cozy-search 0.8.1 → 0.8.2

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.
@@ -11,12 +11,24 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _Markdown = _interopRequireDefault(require("cozy-ui/transpiled/react/Markdown"));
13
13
 
14
+ /**
15
+ * Sanitize chat content by removing special sources tags like
16
+ * [REF]...[/REF] or [doc_X] that are not currently handled.
17
+ *
18
+ * @param {string} content - content to sanitize
19
+ * @returns {string} sanitized content
20
+ */
21
+ var sanitizeContent = function sanitizeContent(content) {
22
+ return content.replace(/\s?\[REF\][\s\S]*?\[\/REF\]/g, '').replace(/\s?\[doc_\d+\]/g, '');
23
+ };
24
+
14
25
  var ChatItemLabel = function ChatItemLabel(_ref) {
15
26
  var label = _ref.label;
27
+ var content = sanitizeContent(label);
16
28
 
17
29
  if (typeof label === 'string') {
18
30
  return /*#__PURE__*/_react.default.createElement(_Markdown.default, {
19
- content: label
31
+ content: content
20
32
  });
21
33
  }
22
34
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cozy-search",
3
3
  "description": "UI components about search bar and IA assistant",
4
- "version": "0.8.1",
4
+ "version": "0.8.2",
5
5
  "author": {
6
6
  "name": "Cozy Cloud",
7
7
  "url": "https://github.com/cozy"
@@ -87,5 +87,5 @@
87
87
  "lint": "cd .. && yarn eslint --ext js,jsx,ts packages/cozy-search"
88
88
  },
89
89
  "types": "dist/index.d.ts",
90
- "gitHead": "420281dac2ce9bfe8a12e771209d0c590389bc42"
90
+ "gitHead": "d92e0d197621f65fe6c5c68c57d15595177eec7b"
91
91
  }