fix(store): Make username case insensitive (#9088)
Username was case sensitive, made username case insensitivepull/9090/head^2
parent
8ca80e05a9
commit
ca91754bc6
|
@ -578,22 +578,22 @@ async def get_user_profile(
|
|||
|
||||
if not profile:
|
||||
logger.warning(f"Profile not found for user {user_id}")
|
||||
await prisma.models.Profile.prisma().create(
|
||||
new_profile = await prisma.models.Profile.prisma().create(
|
||||
data=prisma.types.ProfileCreateInput(
|
||||
userId=user_id,
|
||||
name="No Profile Data",
|
||||
username=f"{random.choice(['happy', 'clever', 'swift', 'bright', 'wise'])}-{random.choice(['fox', 'wolf', 'bear', 'eagle', 'owl'])}_{random.randint(1000,9999)}",
|
||||
username=f"{random.choice(['happy', 'clever', 'swift', 'bright', 'wise'])}-{random.choice(['fox', 'wolf', 'bear', 'eagle', 'owl'])}_{random.randint(1000,9999)}".lower(),
|
||||
description="No Profile Data",
|
||||
links=[],
|
||||
avatarUrl="",
|
||||
)
|
||||
)
|
||||
return backend.server.v2.store.model.ProfileDetails(
|
||||
name="No Profile Data",
|
||||
username="No Profile Data",
|
||||
description="No Profile Data",
|
||||
links=[],
|
||||
avatar_url="",
|
||||
name=new_profile.name,
|
||||
username=new_profile.username,
|
||||
description=new_profile.description,
|
||||
links=new_profile.links,
|
||||
avatar_url=new_profile.avatarUrl,
|
||||
)
|
||||
|
||||
return backend.server.v2.store.model.ProfileDetails(
|
||||
|
@ -651,7 +651,7 @@ async def update_or_create_profile(
|
|||
data={
|
||||
"userId": user_id,
|
||||
"name": profile.name,
|
||||
"username": profile.username,
|
||||
"username": profile.username.lower(),
|
||||
"description": profile.description,
|
||||
"links": profile.links or [],
|
||||
"avatarUrl": profile.avatar_url,
|
||||
|
|
|
@ -254,7 +254,7 @@ async def get_creator(username: str) -> backend.server.v2.store.model.CreatorDet
|
|||
"""
|
||||
try:
|
||||
creator = await backend.server.v2.store.db.get_store_creator_details(
|
||||
username=username
|
||||
username=username.lower()
|
||||
)
|
||||
return creator
|
||||
except Exception:
|
||||
|
|
|
@ -35,9 +35,10 @@ export default async function Page({
|
|||
}: {
|
||||
params: { creator: string; slug: string };
|
||||
}) {
|
||||
const creator_lower = params.creator.toLowerCase();
|
||||
const api = new BackendAPI();
|
||||
const agent = await api.getStoreAgent(params.creator, params.slug);
|
||||
const otherAgents = await api.getStoreAgents({ creator: params.creator });
|
||||
const agent = await api.getStoreAgent(creator_lower, params.slug);
|
||||
const otherAgents = await api.getStoreAgents({ creator: creator_lower });
|
||||
const similarAgents = await api.getStoreAgents({
|
||||
search_query: agent.categories[0],
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ export async function generateMetadata({
|
|||
params: { creator: string };
|
||||
}): Promise<Metadata> {
|
||||
const api = new BackendAPI();
|
||||
const creator = await api.getStoreCreator(params.creator);
|
||||
const creator = await api.getStoreCreator(params.creator.toLowerCase());
|
||||
|
||||
return {
|
||||
title: `${creator.name} - AutoGPT Store`,
|
||||
|
|
Loading…
Reference in New Issue