@adobe/spacecat-shared-utils 1.14.2 → 1.14.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.md +14 -0
- package/package.json +2 -2
- package/src/url-helpers.js +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.14.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.14.3...@adobe/spacecat-shared-utils-v1.14.4) (2024-04-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* strip slash only for / path ([#209](https://github.com/adobe/spacecat-shared/issues/209)) ([4c009ea](https://github.com/adobe/spacecat-shared/commit/4c009ea35e85ee160ee025f53aaa3918f32aa0b1))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-utils-v1.14.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.14.2...@adobe/spacecat-shared-utils-v1.14.3) (2024-04-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/fetch to v4.1.2 ([#206](https://github.com/adobe/spacecat-shared/issues/206)) ([1f5a638](https://github.com/adobe/spacecat-shared/commit/1f5a638b8ded5a7511ecf8a8f3589cfebe7ce29e))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-utils-v1.14.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.14.1...@adobe/spacecat-shared-utils-v1.14.2) (2024-03-23)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-utils",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.4",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"sinon-chai": "3.7.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@adobe/fetch": "4.1.
|
|
42
|
+
"@adobe/fetch": "4.1.2",
|
|
43
43
|
"@aws-sdk/client-s3": "3.540.0",
|
|
44
44
|
"@aws-sdk/client-sqs": "3.540.0",
|
|
45
45
|
"@json2csv/plainjs": "7.0.6"
|
package/src/url-helpers.js
CHANGED
|
@@ -44,12 +44,17 @@ function stripTrailingDot(url) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* Strips the trailing slash from the end of the URL.
|
|
47
|
+
* Strips the trailing slash from the end of the URL if the path is '/'.
|
|
48
48
|
* @param {string} url - The URL to modify.
|
|
49
49
|
* @returns {string} - The URL with the trailing slash removed.
|
|
50
50
|
*/
|
|
51
51
|
function stripTrailingSlash(url) {
|
|
52
|
-
|
|
52
|
+
// remove the scheme (if any) to simplify the slash check
|
|
53
|
+
const schemelessUrl = url.split('://')[1] || url;
|
|
54
|
+
|
|
55
|
+
return schemelessUrl.endsWith('/') && schemelessUrl.split('/').length === 2
|
|
56
|
+
? url.slice(0, -1)
|
|
57
|
+
: url;
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
/**
|