Skip to content

Commit 2359f39

Browse files
committed
fix: cache-bust avatar/header URLs on every save for federated instance refresh
1 parent 553fe4a commit 2359f39

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/routes/bot/profile/+page.server.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const actions = {
8181
if (bskyPostPrefix !== undefined) profile.bskyPostPrefix = bskyPostPrefix;
8282
if (bskyPostSuffix !== undefined) profile.bskyPostSuffix = bskyPostSuffix;
8383

84-
// Handle avatar upload
84+
// Handle avatar upload (cache-bust with timestamp so federated instances re-fetch)
8585
const avatar = formData.get('avatar') as File | null;
8686
if (avatar && avatar.size > 0) {
8787
const result = await processUpload(avatar, 'avatar');
@@ -110,6 +110,15 @@ export const actions = {
110110
}
111111
profile.fields = fields;
112112

113+
// Refresh cache busters on image URLs so federated instances re-fetch them
114+
const cacheBust = `v=${Date.now()}`;
115+
if (profile.avatarUrl) {
116+
profile.avatarUrl = profile.avatarUrl.replace(/\?v=\d+$/, '') + `?${cacheBust}`;
117+
}
118+
if (profile.headerUrl) {
119+
profile.headerUrl = profile.headerUrl.replace(/\?v=\d+$/, '') + `?${cacheBust}`;
120+
}
121+
113122
await saveBotProfile(profile);
114123

115124
try {

0 commit comments

Comments
 (0)