diff options
| author | Mar0xy <marie@kaifa.ch> | 2023-09-25 19:48:43 +0200 |
|---|---|---|
| committer | Mar0xy <marie@kaifa.ch> | 2023-09-25 19:48:43 +0200 |
| commit | 314122f509c62489f34dbb68c5d0344eab2a59d9 (patch) | |
| tree | 1b5747229e17794a3b5c3f5a05dc56f50d4b7a57 /packages/backend/src/server/api | |
| parent | fix: fileid min length issue (diff) | |
| download | sharkey-314122f509c62489f34dbb68c5d0344eab2a59d9.tar.gz sharkey-314122f509c62489f34dbb68c5d0344eab2a59d9.tar.bz2 sharkey-314122f509c62489f34dbb68c5d0344eab2a59d9.zip | |
upd: convert masto ids to sharkeyid on media
Diffstat (limited to 'packages/backend/src/server/api')
| -rw-r--r-- | packages/backend/src/server/api/mastodon/endpoints/status.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts index a6538ddcfe..4a70653434 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/status.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts @@ -217,7 +217,13 @@ export class ApiStatusMastodon { const BASE_URL = `${_request.protocol}://${_request.hostname}`; const accessTokens = _request.headers.authorization; const client = getClient(BASE_URL, accessTokens); + const body: any = _request.body; try { + if (body.media_ids) body.media_ids = undefined; + if (body.media_ids && !body.media_ids.length) body.media_ids = undefined; + if (body.media_ids) { + body.media_ids = (body.media_ids as string[]).map((p) => convertId(p, IdType.SharkeyId)); + } const data = await client.editStatus(convertId(_request.params.id, IdType.SharkeyId), _request.body!); reply.send(convertStatus(data.data)); } catch (e: any) { |