@easyops-cn/docusaurus-search-local 0.33.3 → 0.33.5

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [0.33.5](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.33.4...v0.33.5) (2022-10-24)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * fix see all results with non-ascii chars ([18b5a16](https://github.com/easyops-cn/docusaurus-search-local/commit/18b5a16a809a5eaade321f663b5bcfc9ba650707))
11
+
12
+ ## [0.33.4](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.33.3...v0.33.4) (2022-10-18)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * refine version in search page ([6d091b7](https://github.com/easyops-cn/docusaurus-search-local/commit/6d091b7f1b4294e96dc9a46738920fd5c39b20f8))
18
+
5
19
  ## [0.33.3](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.33.2...v0.33.3) (2022-10-18)
6
20
 
7
21
 
@@ -132,7 +132,7 @@ export default function SearchBar({ handleSearchBarToggle, }) {
132
132
  }
133
133
  const a = document.createElement("a");
134
134
  const params = new URLSearchParams();
135
- params.set("q", encodeURIComponent(query));
135
+ params.set("q", query);
136
136
  if (Array.isArray(searchContextByPaths)) {
137
137
  params.set("ctx", searchContext);
138
138
  }
@@ -12,7 +12,13 @@ export function fetchIndexes(baseUrl, searchContext) {
12
12
  }
13
13
  export async function legacyFetchIndexes(baseUrl, searchContext) {
14
14
  if (process.env.NODE_ENV === "production") {
15
- const json = (await (await fetch(`${baseUrl}${searchIndexUrl.replace("{dir}", searchContext ? `-${searchContext.replace(/\//g, "-")}` : "")}`)).json());
15
+ const url = `${baseUrl}${searchIndexUrl.replace("{dir}", searchContext ? `-${searchContext.replace(/\//g, "-")}` : "")}`;
16
+ // Catch potential attacks.
17
+ const fullUrl = new URL(url, location.origin);
18
+ if (fullUrl.origin !== location.origin) {
19
+ throw new Error("Unexpected version url");
20
+ }
21
+ const json = (await (await fetch(url)).json());
16
22
  const wrappedIndexes = json.map(({ documents, index }, type) => ({
17
23
  type: type,
18
24
  documents,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyops-cn/docusaurus-search-local",
3
- "version": "0.33.3",
3
+ "version": "0.33.5",
4
4
  "description": "An offline/local search plugin for Docusaurus v2",
5
5
  "repository": "https://github.com/easyops-cn/docusaurus-search-local",
6
6
  "homepage": "https://github.com/easyops-cn/docusaurus-search-local",