@sprigr/apps-app-sdk 0.21.0 → 0.21.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.
Files changed (2) hide show
  1. package/dist/index.js +6 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -453,10 +453,15 @@ async function openFileRef(env, ref, opts) {
453
453
  const openUrl = async (url, via, filename) => {
454
454
  let res;
455
455
  try {
456
- res = await fetch(url, { signal: AbortSignal.timeout(timeoutMs), redirect: "error" });
456
+ res = await fetch(url, { signal: AbortSignal.timeout(timeoutMs), redirect: "manual" });
457
457
  } catch (err) {
458
458
  throw failure(err);
459
459
  }
460
+ if (res.type === "opaqueredirect" || res.status >= 300 && res.status < 400) {
461
+ await res.body?.cancel().catch(() => {
462
+ });
463
+ throw new FileRefError("read_failed", `Could not read ${label}: the link redirected; refusing to follow.`);
464
+ }
460
465
  if (!res.ok) {
461
466
  await res.body?.cancel().catch(() => {
462
467
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprigr/apps-app-sdk",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",