@plone/volto 16.20.3 → 16.20.4

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.draft CHANGED
@@ -1,6 +1,10 @@
1
- ## 16.20.3 (2023-04-18)
1
+ ## 16.20.4 (2023-04-20)
2
2
 
3
3
  ### Bugfix
4
4
 
5
- - Revert inadvertently included files from another PR in #4710 @sneridagh [#4713](https://github.com/plone/volto/issues/4713)
5
+ - Fix fetching API paths with urlencoded characters in the querystring. @davisagli [#4718](https://github.com/plone/volto/issues/4718)
6
+
7
+ ### Internal
8
+
9
+ - Security upgrade for momentjs [#4716](https://github.com/plone/volto/issues/4716)
6
10
 
Binary file
package/CHANGELOG.md CHANGED
@@ -8,6 +8,17 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 16.20.4 (2023-04-20)
12
+
13
+ ### Bugfix
14
+
15
+ - Fix fetching API paths with urlencoded characters in the querystring. @davisagli [#4718](https://github.com/plone/volto/issues/4718)
16
+
17
+ ### Internal
18
+
19
+ - Security upgrade for momentjs [#4716](https://github.com/plone/volto/issues/4716)
20
+
21
+
11
22
  ## 16.20.3 (2023-04-18)
12
23
 
13
24
  ### Bugfix
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.20.3",
12
+ "version": "16.20.4",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -313,7 +313,7 @@
313
313
  "lodash-move": "1.1.1",
314
314
  "lodash-webpack-plugin": "0.11.5",
315
315
  "mini-css-extract-plugin": "0.9.0",
316
- "moment": "2.24.0",
316
+ "moment": "2.29.4",
317
317
  "object-assign": "4.1.1",
318
318
  "pofile": "1.0.10",
319
319
  "postcss": "8.4.13",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.20.3",
3
+ "version": "16.20.4",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -53,6 +53,60 @@ describe('api middleware helpers', () => {
53
53
  );
54
54
  expect(result).toEqual('/de/mypage/@navigation?expand.navigation.depth=3');
55
55
  });
56
+ it('addExpandersToPath - Path matching, preserve query', () => {
57
+ config.settings.apiExpanders = [
58
+ {
59
+ match: '/de/mypage',
60
+ GET_CONTENT: ['mycustomexpander', 'mycustomexpander2'],
61
+ },
62
+ ];
63
+
64
+ const result = addExpandersToPath(
65
+ '/de/mypage/@navigation?expand.navigation.depth=3',
66
+ GET_CONTENT,
67
+ );
68
+ expect(result).toEqual(
69
+ '/de/mypage/@navigation?expand=mycustomexpander,mycustomexpander2&expand.navigation.depth=3',
70
+ );
71
+ });
72
+ it('addExpandersToPath - Path matching, preserve query with multiple', () => {
73
+ config.settings.apiExpanders = [
74
+ {
75
+ match: '/de/mypage',
76
+ GET_CONTENT: ['mycustomexpander', 'mycustomexpander2'],
77
+ },
78
+ ];
79
+
80
+ const result = addExpandersToPath(
81
+ '/de/mypage/@navigation?expand.navigation.depth=3&expand.other=2',
82
+ GET_CONTENT,
83
+ );
84
+ expect(result).toEqual(
85
+ '/de/mypage/@navigation?expand=mycustomexpander,mycustomexpander2&expand.navigation.depth=3&expand.other=2',
86
+ );
87
+ });
88
+ it('addExpandersToPath - Path not matching, preserve encoded query', () => {
89
+ config.settings.apiExpanders = [
90
+ {
91
+ match: '/de/otherpath',
92
+ GET_CONTENT: ['mycustomexpander'],
93
+ },
94
+ ];
95
+
96
+ const result = addExpandersToPath('/de/mypage?query=a%26b', GET_CONTENT);
97
+ expect(result).toEqual('/de/mypage?query=a%26b');
98
+ });
99
+ it('addExpandersToPath - Path matching, preserve encoded query', () => {
100
+ config.settings.apiExpanders = [
101
+ {
102
+ match: '/de/mypage',
103
+ GET_CONTENT: ['mycustomexpander'],
104
+ },
105
+ ];
106
+
107
+ const result = addExpandersToPath('/de/mypage?query=a%26b', GET_CONTENT);
108
+ expect(result).toEqual('/de/mypage?expand=mycustomexpander&query=a%26b');
109
+ });
56
110
  it('addExpandersToPath - Two custom expanders from settings', () => {
57
111
  config.settings.apiExpanders = [
58
112
  {
@@ -43,7 +43,7 @@ export function addExpandersToPath(path, type, isAnonymous) {
43
43
  const {
44
44
  url,
45
45
  query: { expand, ...query },
46
- } = qs.parseUrl(path);
46
+ } = qs.parseUrl(path, { decode: false });
47
47
 
48
48
  const expandersFromConfig = apiExpanders
49
49
  .filter((expand) => matchPath(url, expand.match) && expand[type])