Skip to content

Commit

Permalink
Fix network url regex (#2033)
Browse files Browse the repository at this point in the history
  • Loading branch information
OKendigelyan authored Oct 29, 2024
1 parent 3ec99a4 commit e7b81b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions apps/web/src/components/Menu/DrawerContentWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const DrawerContentWrapper = ({
as={Flex}
position="relative"
flexDirection="column"
overflowX="hidden"
onScroll={handleScroll}
paddingX={{ base: "24px", md: "40px" }}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/utils/validationSchemes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("getNetworkValidationScheme", () => {
expect.objectContaining({ message: "RPC URL must be secure and start with 'https://'" }),
expect.objectContaining({ message: "Enter a valid Tzkt API URL" }),
expect.objectContaining({
message: "Tzkt Explorer URL must be secure and start with 'https://'",
message: "Enter a valid Tzkt Explorer URL",
}),
])
);
Expand Down
10 changes: 2 additions & 8 deletions packages/components/src/utils/validationSchemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ import { PROHIBITED_CHARACTERS } from "@umami/state";
import { type Network } from "@umami/tezos";
import { z } from "zod";

const URL_REGEX = new RegExp(
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
"((\\d{1,3}\\.){3}\\d{1,3}))" + // OR IP (v4) address
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
"(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
"(\\#[-a-z\\d_]*)?$",
"i"
);
const URL_REGEX =
/^(https?:\/\/)?(www\.)?([a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)(\/[a-zA-Z0-9_-]+)*(\/?|\?[a-zA-Z0-9_-]+=?[a-zA-Z0-9_-]*(&[a-zA-Z0-9_-]+=?[a-zA-Z0-9_-]*)*)?(#[a-zA-Z0-9_-]+)?$/;

const urlScheme = (urlType: string) =>
z
Expand Down

1 comment on commit e7b81b3

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title Lines Statements Branches Functions
apps/desktop Coverage: 83%
83.6% (1765/2111) 78.81% (837/1062) 78.14% (447/572)
apps/web Coverage: 83%
83.6% (1765/2111) 78.81% (837/1062) 78.14% (447/572)
packages/components Coverage: 97%
97.84% (182/186) 96.51% (83/86) 87.03% (47/54)
packages/core Coverage: 81%
82.22% (222/270) 71.73% (99/138) 81.96% (50/61)
packages/crypto Coverage: 100%
100% (43/43) 90.9% (10/11) 100% (7/7)
packages/data-polling Coverage: 97%
95.27% (141/148) 87.5% (21/24) 92.85% (39/42)
packages/multisig Coverage: 98%
98.47% (129/131) 85.71% (18/21) 100% (35/35)
packages/social-auth Coverage: 100%
100% (21/21) 100% (11/11) 100% (3/3)
packages/state Coverage: 85%
84.71% (798/942) 81.33% (170/209) 78.77% (297/377)
packages/tezos Coverage: 86%
85.57% (89/104) 89.47% (17/19) 82.75% (24/29)
packages/tzkt Coverage: 86%
84.05% (58/69) 81.25% (13/16) 76.92% (30/39)

Please sign in to comment.