@atproto/pds 0.4.214 → 0.4.215

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/tests/_util.ts CHANGED
@@ -57,26 +57,28 @@ export const forSnapshot = (obj: unknown) => {
57
57
  if (str.match(/^\d+(?:__|::)did:plc/)) {
58
58
  return constantDidCursor
59
59
  }
60
- if (str.match(/\/image\/[^/]+\/.+\/did:plc:[^/]+\/[^/]+@[\w]+$/)) {
61
- // Match image urls (pds)
60
+ if (str.match(/\/image\/[^/]+\/.+\/did:plc:[^/]+\/[^/@]+(?:@[\w]+)?$/)) {
61
+ // Match image urls (pds), stripping optional format suffix (e.g. @webp) for stable snapshots
62
62
  const match = str.match(
63
- /\/image\/([^/]+)\/.+\/(did:plc:[^/]+)\/([^/]+)@[\w]+$/,
63
+ /\/image\/([^/]+)\/.+\/(did:plc:[^/]+)\/([^/@]+)(?:@[\w]+)?$/,
64
64
  )
65
65
  if (!match) return str
66
66
  const [, sig, did, cid] = match
67
67
  return str
68
68
  .replace(sig, 'sig()')
69
69
  .replace(did, take(users, did))
70
- .replace(cid, take(cids, cid))
70
+ .replace(new RegExp(`${cid}(?:@\\w+)?`), take(cids, cid))
71
71
  }
72
- if (str.match(/\/img\/[^/]+\/.+\/did:plc:[^/]+\/[^/]+@[\w]+$/)) {
73
- // Match image urls (bsky w/ presets)
72
+ if (str.match(/\/img\/[^/]+\/.+\/did:plc:[^/]+\/[^/@]+(?:@[\w]+)?$/)) {
73
+ // Match image urls (bsky w/ presets), stripping optional format suffix (e.g. @webp) for stable snapshots
74
74
  const match = str.match(
75
- /\/img\/[^/]+\/.+\/(did:plc:[^/]+)\/([^/]+)@[\w]+$/,
75
+ /\/img\/[^/]+\/.+\/(did:plc:[^/]+)\/([^/@]+)(?:@[\w]+)?$/,
76
76
  )
77
77
  if (!match) return str
78
78
  const [, did, cid] = match
79
- return str.replace(did, take(users, did)).replace(cid, take(cids, cid))
79
+ return str
80
+ .replace(did, take(users, did))
81
+ .replace(new RegExp(`${cid}(?:@\\w+)?`), take(cids, cid))
80
82
  }
81
83
  if (str.startsWith('localhost-')) {
82
84
  return 'invite-code'
@@ -11,7 +11,7 @@ Object {
11
11
  "allowSubscriptions": "followers",
12
12
  },
13
13
  },
14
- "avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
14
+ "avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)",
15
15
  "createdAt": "1970-01-01T00:00:00.000Z",
16
16
  "did": "user(0)",
17
17
  "displayName": "ali",
@@ -101,13 +101,13 @@ Object {
101
101
  "images": Array [
102
102
  Object {
103
103
  "alt": "../dev-env/assets/key-landscape-small.jpg",
104
- "fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(3)/cids(4)@jpeg",
105
- "thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(3)/cids(4)@jpeg",
104
+ "fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(3)/cids(4)",
105
+ "thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(3)/cids(4)",
106
106
  },
107
107
  Object {
108
108
  "alt": "../dev-env/assets/key-alt.jpg",
109
- "fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(3)/cids(5)@jpeg",
110
- "thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(3)/cids(5)@jpeg",
109
+ "fullsize": "https://bsky.public.url/img/feed_fullsize/plain/user(3)/cids(5)",
110
+ "thumb": "https://bsky.public.url/img/feed_thumbnail/plain/user(3)/cids(5)",
111
111
  },
112
112
  ],
113
113
  },
@@ -120,7 +120,7 @@ Object {
120
120
  "allowSubscriptions": "followers",
121
121
  },
122
122
  },
123
- "avatar": "https://bsky.public.url/img/avatar/plain/user(5)/cids(1)@jpeg",
123
+ "avatar": "https://bsky.public.url/img/avatar/plain/user(5)/cids(1)",
124
124
  "createdAt": "1970-01-01T00:00:00.000Z",
125
125
  "did": "user(4)",
126
126
  "displayName": "bobby",