From d3b2f14fd2270f90ee8fcc93d32af2442e978975 Mon Sep 17 00:00:00 2001 From: Priec Date: Mon, 17 Aug 2026 18:10:23 +0200 Subject: [PATCH] number can be converted to the string as a backup for server to validate it --- web/src/pages/import_export/common/schema.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/web/src/pages/import_export/common/schema.rs b/web/src/pages/import_export/common/schema.rs index 02c602a0..25560e33 100644 --- a/web/src/pages/import_export/common/schema.rs +++ b/web/src/pages/import_export/common/schema.rs @@ -112,16 +112,10 @@ pub(crate) fn csv_value(locale: Locale, raw: &str, data_type: &str) -> Result() - .map_err(|_| { - tr!( - locale, - "import-err-bad-integer", - "value" => raw.to_string(), - ) - })?; - Kind::NumberValue(integer as f64) + match raw.parse::() { + Ok(integer) => Kind::NumberValue(integer as f64), + Err(_) => Kind::StringValue(raw.to_string()), + } } else { Kind::StringValue(raw.to_string()) }; @@ -188,5 +182,9 @@ mod tests { ); } - + #[test] + fn integer_columns_pass_non_numeric_text_to_the_backend() { + let value = csv_value(Locale::English, "KUPE SRO", "BIGINT").unwrap(); + assert_eq!(value.kind, Some(Kind::StringValue("KUPE SRO".to_string()))); + } }