From 8af4e4b8dd19f11094d8c1f1b3293fc7cce1227c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Mon, 27 Jan 2025 16:13:21 +0100 Subject: [PATCH 1/2] fix(html-transformer): preserve title tag --- apps/api/sharedLibs/html-transformer/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/api/sharedLibs/html-transformer/src/lib.rs b/apps/api/sharedLibs/html-transformer/src/lib.rs index 4b1b57cf..f5eb86e5 100644 --- a/apps/api/sharedLibs/html-transformer/src/lib.rs +++ b/apps/api/sharedLibs/html-transformer/src/lib.rs @@ -128,7 +128,9 @@ pub unsafe extern "C" fn extract_metadata(html: *const libc::c_char) -> *mut i8 if let Some(v) = out.get(name) { match v { Value::String(_) => { - out.insert(name.to_string(), Value::Array(vec! [v.clone(), Value::String(content.to_string())])); + if name != "title" { // preserve title tag in metadata + out.insert(name.to_string(), Value::Array(vec! [v.clone(), Value::String(content.to_string())])); + } }, Value::Array(_) => { match out.get_mut(name) { From 9d448d18d391d22c624e97995488f4a7ab0795b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Mon, 27 Jan 2025 16:39:40 +0100 Subject: [PATCH 2/2] feat(v1): support cyrillic URLs --- apps/api/src/controllers/v1/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts index 13b14116..b8ed65df 100644 --- a/apps/api/src/controllers/v1/types.ts +++ b/apps/api/src/controllers/v1/types.ts @@ -34,7 +34,7 @@ export const url = z.preprocess( .url() .regex(/^https?:\/\//, "URL uses unsupported protocol") .refine( - (x) => /\.[a-z]{2,}(:\d+)?([\/?#]|$)/i.test(x), + (x) => /\.[a-zA-Z\u0400-\u04FF\u0500-\u052F\u2DE0-\u2DFF\uA640-\uA69F]{2,}(:\d+)?([\/?#]|$)/i.test(x), "URL must have a valid top-level domain or be a valid path", ) .refine((x) => {