Skip to content

Fix avatar url type of update avatar #575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025

Conversation

huyuwei1996
Copy link
Contributor

No description provided.

@wu-clan
Copy link
Member

wu-clan commented Apr 16, 2025

我刚测试了下,不加类型转换也是正常的

@huyuwei1996
Copy link
Contributor Author

擦,同样代码mysql 没问题。pg 就报错了,我用的 pg

# 绑定社交用户
sys_user_id = sys_user.id
if social_avatar:
    await user_dao.update_avatar(db, sys_user_id, AvatarParam(url=social_avatar))

(sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.DataError'>: invalid input for query argument $1: HttpUrl('https://s1-imfile.feishucdn.com... (expected str, got HttpUrl)

@wu-clan
Copy link
Member

wu-clan commented Apr 17, 2025

调查了下,pg 似乎必须明确类型,我想此 PR 正确的

@wu-clan wu-clan changed the title Fix avatar URL type in update_avatar method Fix avatar url type of update avatar Apr 17, 2025
@wu-clan wu-clan self-requested a review April 17, 2025 07:01
@wu-clan wu-clan merged commit 2d504f2 into fastapi-practices:master Apr 17, 2025
4 checks passed
@huyuwei1996 huyuwei1996 deleted the fix/oauth2 branch April 17, 2025 11:21
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