github-actions[bot] commited on
Commit
2aa6de4
·
1 Parent(s): f660330

Update from GitHub Actions

Browse files
Files changed (1) hide show
  1. functions/api/github/[[path]].ts +2 -1
functions/api/github/[[path]].ts CHANGED
@@ -23,7 +23,8 @@ export const onRequest = async (context: RouteContext): Promise<Response> => {
23
  const pathParts = url.pathname.split('/').filter(Boolean);
24
  const owner = pathParts[2] || url.searchParams.get('owner'); // 仓库所有者
25
  const repo = pathParts[3] || url.searchParams.get('repo'); // 仓库名称
26
- const path = pathParts[4] || url.searchParams.get('path') || ""; // 文件路径
 
27
  if (!owner || !repo) {
28
  return new Response(JSON.stringify({ error: '缺少仓库所有者或仓库名称' }), {
29
  status: 400,
 
23
  const pathParts = url.pathname.split('/').filter(Boolean);
24
  const owner = pathParts[2] || url.searchParams.get('owner'); // 仓库所有者
25
  const repo = pathParts[3] || url.searchParams.get('repo'); // 仓库名称
26
+ // 获取剩余的所有路径部分
27
+ const path = pathParts.length > 4 ? pathParts.slice(4).join('/') : (url.searchParams.get('path') || "");
28
  if (!owner || !repo) {
29
  return new Response(JSON.stringify({ error: '缺少仓库所有者或仓库名称' }), {
30
  status: 400,