Skip to content

Commit af60eac

Browse files
virgoonejasonraimondi
authored andcommitted
feat: add encode url support
1 parent 5eb5e4c commit af60eac

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/lib/schema.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,19 @@ const zodStringBool = z
77
.transform(x => x === "true")
88
.pipe(z.boolean());
99

10+
const zodStringUrl = z
11+
.string()
12+
.transform(value => {
13+
try {
14+
return decodeURIComponent(value);
15+
} catch (error) {
16+
return value;
17+
}
18+
})
19+
.pipe(z.string().url());
20+
1021
export const PlainConfigSchema = z.object({
11-
url: z.string().url(),
22+
url: zodStringUrl,
1223
width: z.coerce.number().nullish(),
1324
height: z.coerce.number().nullish(),
1425
viewPortWidth: z.coerce.number().nullish(),

0 commit comments

Comments
 (0)