fix(routes): 修复 Shopify 路由语言代码不一致的问题 (#18353)

- 修改 language 属性,统一将 'en-US' 更改为 'en-us'
- 改进 /shopify/apps/search 路由参数校验逻辑,避免空查询返回无效值
This commit is contained in:
Shine 2025-02-14 23:48:08 +08:00 committed by GitHub
parent 66f0e41188
commit 8929c27297
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -72,7 +72,7 @@ async function handler(ctx: Context): Promise<Data> {
title: `Reviews handle:${handle} page:${page} Shopify App Store`,
link: `${baseURL}/${handle}/reviews`,
allowEmpty: true,
language: 'en-US',
language: 'en-us',
item: items,
};
}

View File

@ -15,8 +15,11 @@ export const route: Route = {
{
source: ['apps.shopify.com/search'],
target: (_params, url) => {
const { searchParams } = new URL(url).searchParams;
return searchParams.has('q') ? `/shopify/apps/search/${searchParams.get('q')}` : null;
const searchParams = new URL(url).searchParams;
if (!searchParams.has('q')) {
return '';
}
return `/shopify/apps/search/${searchParams.get('q')}`;
},
},
],
@ -76,7 +79,7 @@ async function handler(ctx: Context): Promise<Data> {
link: `https://apps.shopify.com/search?q=${q}`,
// description: `Search results for "${q}" Shopify App Store`,
allowEmpty: true,
language: 'en-US',
language: 'en-us',
item: items,
};
}