@artsy/img 1.0.1 → 1.0.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.
- package/CHANGELOG.md +12 -0
- package/dist/services/lambda.js +2 -1
- package/package.json +1 -1
- package/src/__tests__/services.test.ts +12 -0
- package/src/services/lambda.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v1.0.2 (Tue Dec 20 2022)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- fix(lambda): adds another encoding edge case [#12](https://github.com/artsy/img/pull/12) ([@dzucconi](https://github.com/dzucconi))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Damon ([@dzucconi](https://github.com/dzucconi))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v1.0.1 (Mon Dec 19 2022)
|
|
2
14
|
|
|
3
15
|
#### 🐛 Bug Fix
|
package/dist/services/lambda.js
CHANGED
|
@@ -11,9 +11,10 @@ const lambda = (config) => {
|
|
|
11
11
|
});
|
|
12
12
|
if (!source)
|
|
13
13
|
return src;
|
|
14
|
+
const key = decodeURIComponent(src.replace(`${source.source}/`, "")).replace("+", " ");
|
|
14
15
|
const params = {
|
|
15
16
|
bucket: source.bucket,
|
|
16
|
-
key
|
|
17
|
+
key,
|
|
17
18
|
edits: {
|
|
18
19
|
resize: {
|
|
19
20
|
width,
|
package/package.json
CHANGED
|
@@ -124,5 +124,17 @@ describe("strategies", () => {
|
|
|
124
124
|
"https://d1j88w5k23s1nr.cloudfront.net/eyJidWNrZXQiOiJhcnRzeS1tZWRpYS11cGxvYWRzIiwia2V5IjoiTUpWRGxaZHBhaDhwVTJjQVNhbldiUS9BUEIwMDQ4X0FfcGhjM2NjLmpwZWciLCJlZGl0cyI6eyJyZXNpemUiOnsid2lkdGgiOjIwMCwiaGVpZ2h0IjoyMDAsImZpdCI6ImNvdmVyIn0sIndlYnAiOnsicXVhbGl0eSI6ODB9LCJqcGVnIjp7InF1YWxpdHkiOjgwfSwicm90YXRlIjpudWxsfX0="
|
|
125
125
|
);
|
|
126
126
|
});
|
|
127
|
+
|
|
128
|
+
it('decodes any encoded keys with a "+"', () => {
|
|
129
|
+
const img = lambda.exec(
|
|
130
|
+
"crop",
|
|
131
|
+
"https://artsy-media-uploads.s3.amazonaws.com/IxeU8_kDftXzCfFdM36fWA/MAG_Textile+Artists.jpg",
|
|
132
|
+
{ width: 200, height: 200 }
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
expect(img).toEqual(
|
|
136
|
+
"https://d1j88w5k23s1nr.cloudfront.net/eyJidWNrZXQiOiJhcnRzeS1tZWRpYS11cGxvYWRzIiwia2V5IjoiSXhlVThfa0RmdFh6Q2ZGZE0zNmZXQS9NQUdfVGV4dGlsZSBBcnRpc3RzLmpwZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6MjAwLCJoZWlnaHQiOjIwMCwiZml0IjoiY292ZXIifSwid2VicCI6eyJxdWFsaXR5Ijo4MH0sImpwZWciOnsicXVhbGl0eSI6ODB9LCJyb3RhdGUiOm51bGx9fQ=="
|
|
137
|
+
);
|
|
138
|
+
});
|
|
127
139
|
});
|
|
128
140
|
});
|
package/src/services/lambda.ts
CHANGED
|
@@ -22,9 +22,13 @@ export const lambda = (config: Lambda): ResizeExec => {
|
|
|
22
22
|
|
|
23
23
|
if (!source) return src;
|
|
24
24
|
|
|
25
|
+
const key = decodeURIComponent(
|
|
26
|
+
src.replace(`${source.source}/`, "")
|
|
27
|
+
).replace("+", " ");
|
|
28
|
+
|
|
25
29
|
const params = {
|
|
26
30
|
bucket: source.bucket,
|
|
27
|
-
key
|
|
31
|
+
key,
|
|
28
32
|
edits: {
|
|
29
33
|
resize: {
|
|
30
34
|
width,
|