From 4235115b834edce4eaa86ece35f15e0e98acb79c Mon Sep 17 00:00:00 2001 From: Luiz Motta Date: Tue, 24 Sep 2024 11:44:31 -0300 Subject: [PATCH] Fix github raw url parsing --- packages/online-editor/src/importFromUrl/ImportableUrlHooks.tsx | 2 +- .../src/workspace/hooks/ImportableUrlHooks.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/online-editor/src/importFromUrl/ImportableUrlHooks.tsx b/packages/online-editor/src/importFromUrl/ImportableUrlHooks.tsx index 664da3e60d2..a7cb1a9858b 100644 --- a/packages/online-editor/src/importFromUrl/ImportableUrlHooks.tsx +++ b/packages/online-editor/src/importFromUrl/ImportableUrlHooks.tsx @@ -334,7 +334,7 @@ export function useImportableUrl(urlString?: string, allowedUrlTypes?: UrlType[] if (url.host === "raw.githubusercontent.com") { const gitHubRawFileMatch = matchPath<{ org: string; repo: string; tree: string; path: string }>(url.pathname, { - path: "/:org/:repo/:tree/:path*", + path: "/:org/:repo/refs/heads/:tree/:path*", exact: true, strict: true, sensitive: false, diff --git a/packages/serverless-logic-web-tools/src/workspace/hooks/ImportableUrlHooks.tsx b/packages/serverless-logic-web-tools/src/workspace/hooks/ImportableUrlHooks.tsx index aa70b60c32f..62e2e60d52e 100644 --- a/packages/serverless-logic-web-tools/src/workspace/hooks/ImportableUrlHooks.tsx +++ b/packages/serverless-logic-web-tools/src/workspace/hooks/ImportableUrlHooks.tsx @@ -152,7 +152,7 @@ export function useImportableUrl(args: { } const gitHubRawFileMatch = matchPath<{ org: string; repo: string; tree: string; path: string }>(url.pathname, { - path: "/:org/:repo/:tree/:path*", + path: "/:org/:repo/refs/heads/:tree/:path*", exact: true, strict: true, sensitive: false,