Commit 0b7bbad
authored
fix(dexie-cloud): allow anonymous blob download + fix SW Dexie.ignoreTransaction crash (#2287)
* fix(dexie-cloud): allow anonymous blob download and fix SW Dexie.ignoreTransaction crash
Two bugs fixed:
1. BlobDownloadTracker: Remove hard requirement for access token.
Public realm (rlm-public) blobs must be downloadable without auth.
downloadBlob() now omits the Authorization header when token is null,
letting the server decide whether to allow anonymous access.
2. loadCachedAccessToken: Skip Dexie.ignoreTransaction() when user is
not logged in. Previously this always fell through to a DB lookup via
Dexie.ignoreTransaction() even for unauthenticated users who clearly
have no token to find. This caused a crash in service worker context
where PSD.transless.env is undefined when called from within an active
rw transaction (e.g. during applyServerChanges after sync).
The fix: if currentUser.isLoggedIn is falsy, return null immediately
without touching Dexie.ignoreTransaction.
* fix(dexie): guard Dexie.ignoreTransaction against undefined PSD.transless
PSD.transless can be undefined even when PSD.trans is truthy (e.g. in
service worker context). This caused a crash in switchToZone when
accessing targetZone.env on the undefined transless PSD.
Fix: check both PSD.trans AND PSD.transless before calling usePSD.
If transless is undefined, fall through to calling scopeFunc() directly
(same as no-transaction case).
* fix(dexie): use PSD.transless || globalPSD in ignoreTransaction
Better approach: instead of skipping usePSD when transless is undefined,
fall back to globalPSD. This ensures the zone switch always happens with
a valid PSD that has proper env properties for promise patching.1 parent 7d3535e commit 0b7bbad
3 files changed
Lines changed: 23 additions & 11 deletions
File tree
- addons/dexie-cloud/src/sync
- src/classes/dexie
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
51 | | - | |
| 55 | + | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | | - | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
0 commit comments