Skip to content

Commit

Permalink
Fix an issue with legacy assets not getting their urls changed when t…
Browse files Browse the repository at this point in the history
…hey get slurped. (tldraw#5270)

Looks like this change was lost (might have forgot to push it).

### Change type

- [x] `bugfix`
  • Loading branch information
MitjaBezensek authored Jan 23, 2025
1 parent 5d3e4a1 commit 1fd1056
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/dotcom/sync-worker/src/TLDrawDurableObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,13 @@ export class TLDrawDurableObject extends DurableObject {
httpMetadata: currentAsset.httpMetadata,
})
asset.props.src = asset.props.src.replace(objectName, newObjectName)
if (asset.props.src.includes(this.env.ASSET_UPLOAD_ORIGIN)) {
asset.props.src.replace(
this.env.ASSET_UPLOAD_ORIGIN,
`${this.env.MULTIPLAYER_SERVER}/api/app`
)
}

asset.meta.fileId = slug
store.put(asset)
assetsToUpdate.push({ objectName: newObjectName, fileId: slug })
Expand Down
1 change: 1 addition & 0 deletions apps/dotcom/sync-worker/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface Environment {
IS_LOCAL: string | undefined
WORKER_NAME: string | undefined
ASSET_UPLOAD_ORIGIN: string | undefined
MULTIPLAYER_SERVER: string | undefined

RATE_LIMITER: RateLimit
}
Expand Down
1 change: 1 addition & 0 deletions internal/scripts/deploy-dotcom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ async function deployTlsyncWorker({ dryRun }: { dryRun: boolean }) {
CLERK_PUBLISHABLE_KEY: env.VITE_CLERK_PUBLISHABLE_KEY,
BOTCOM_POSTGRES_CONNECTION_STRING,
BOTCOM_POSTGRES_POOLED_CONNECTION_STRING,
MULTIPLAYER_SERVER: env.MULTIPLAYER_SERVER,
},
sentry: {
project: 'tldraw-sync',
Expand Down

0 comments on commit 1fd1056

Please sign in to comment.