Skip to content

feat(user): upload avatars through multipart endpoint#3302

Merged
nighca merged 1 commit into
goplus:devfrom
aofei:user-avatar-multipart
Jun 25, 2026
Merged

feat(user): upload avatars through multipart endpoint#3302
nighca merged 1 commit into
goplus:devfrom
aofei:user-avatar-multipart

Conversation

@aofei

@aofei aofei commented Jun 22, 2026

Copy link
Copy Markdown
Member

Move signed-in user avatar updates out of profile patch requests and onto the dedicated /user/avatar multipart upload endpoint.

Keep profile patches scoped to text fields and refresh the signed-in user after avatar upload so callers receive the updated avatar URL.

gemini-code-assist[bot]

This comment was marked as resolved.

fennoai[bot]

This comment was marked as resolved.

if (blob.size > maxAvatarFileSize) {
throw new DefaultException({
en: 'Avatar image must be 5 MiB or smaller',
zh: '头像图片不能超过 5 MiB'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: 发现这里原来的提示文案是 MiB,其他地方(复用的 humanizeFileSize)应该都是 KB/MB/...;按理说 MiB 会准确一些,不过对用户可能会增加理解成本,有点纠结,我建个单独的 issue 跟下这个吧

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xgopilot Create an issue to track this.

This comment was marked as low quality.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哦用 MiB 这种算是我的个人习惯吧,这里没注意,不过我倒是也能接受面对普通用户用 MB

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看用 MB 也有 1024/1000 的争议;那可以这里先跟其他地方一样统一为 MB(1024),要不要换 1000 或者换单位再统一看

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文案上我觉得用 MB/MiB 都还好,但具体实现上我建议不要统一成 1000,这个太别扭了

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/goplus/builder/compare/e77ff8c2668e5f65e76f97926f74806894623779..85202a6c3eec7f04f5b00c63a3007d77887d7a64 我先给统一了一下,前端文案上统一用 MB,api spec 文案上用 MiB

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Move signed-in user avatar updates out of profile patch requests and
onto the dedicated `/user/avatar` multipart upload endpoint.

Keep profile patches scoped to text fields and refresh the signed-in
user after avatar upload so callers receive the updated avatar URL.

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
@aofei aofei force-pushed the user-avatar-multipart branch from e77ff8c to 85202a6 Compare June 25, 2026 10:22
@nighca nighca merged commit 5acc417 into goplus:dev Jun 25, 2026
5 checks passed
@aofei aofei deleted the user-avatar-multipart branch June 25, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants