Skip to content

Commit fe5da1f

Browse files
committed
Don't re-cast to UUID if database returns already parsed type
1 parent 6945e46 commit fe5da1f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

github/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ async def run_post_migration(self, conn: Connection, secret_key: str) -> None:
228228
await conn.fetch("SELECT id, repo, user_id, room_id, github_id FROM webhook_old")
229229
)
230230
for row in rows:
231-
id = uuid.UUID(row["id"])
231+
id = row["id"] if isinstance(row["id"], uuid.UUID) else uuid.UUID(row["id"])
232232
secret = hmac.new(key=secret_key.encode("utf-8"), digestmod=hashlib.sha256)
233233
secret.update(id.bytes)
234234
secret.update(row["user_id"].encode("utf-8"))

0 commit comments

Comments
 (0)