grist-widget-sdk 0.6.0 → 0.6.1
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 +8 -0
- package/dist/app.cjs +5 -1
- package/dist/app.cjs.map +1 -1
- package/dist/app.js +2 -2
- package/dist/{chunk-DKCRFNAW.js → chunk-JJ23G6RR.js} +6 -2
- package/dist/chunk-JJ23G6RR.js.map +1 -0
- package/dist/{chunk-TUPCTWE5.js → chunk-KHOPLBCJ.js} +2 -2
- package/dist/emulator/testing.cjs +5 -1
- package/dist/emulator/testing.cjs.map +1 -1
- package/dist/emulator/testing.js +2 -2
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-DKCRFNAW.js.map +0 -1
- /package/dist/{chunk-TUPCTWE5.js.map → chunk-KHOPLBCJ.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# grist-widget-sdk
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 71785f8: **Attachment URLs only take an attachment id.** `getAttachmentUrl()`, `fetchAttachmentBlob()` (and the helpers behind them) now refuse anything but a positive integer as the attachment id, before asking Grist for an access token: the id usually comes from a cell, and the URL built from it carries the document's token, so a crafted value (`"1/../tables"`) could otherwise aim it at another route of the same Grist. The token in the URL is now encoded too.
|
|
8
|
+
|
|
9
|
+
`grist-widget-sdk` no longer depends on `grain-rpc`, which nothing imported since the iframe transport was removed: one package fewer in every widget.
|
|
10
|
+
|
|
3
11
|
## 0.6.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/app.cjs
CHANGED
|
@@ -365,8 +365,12 @@ async function getAttachmentDownloadUrl(docApi, attachmentId, options) {
|
|
|
365
365
|
if (!getAccessToken) {
|
|
366
366
|
throw new Error("getAccessToken is not available on docApi");
|
|
367
367
|
}
|
|
368
|
+
const id = String(attachmentId).trim();
|
|
369
|
+
if (!/^[1-9]\d*$/.test(id)) {
|
|
370
|
+
throw new Error(`getAttachmentDownloadUrl: "${attachmentId}" is not an attachment id (a positive integer).`);
|
|
371
|
+
}
|
|
368
372
|
const { token: token2, baseUrl } = await getAccessToken({ readOnly: options?.readOnly ?? false });
|
|
369
|
-
return `${baseUrl}/attachments/${
|
|
373
|
+
return `${baseUrl}/attachments/${id}/download?auth=${encodeURIComponent(token2)}`;
|
|
370
374
|
}
|
|
371
375
|
async function fetchBytesFromSignedAttachmentUrl(url) {
|
|
372
376
|
const response = await fetch(url);
|