diff --git a/src/endpoints/create.rs b/src/endpoints/create.rs index be8250d..715007e 100644 --- a/src/endpoints/create.rs +++ b/src/endpoints/create.rs @@ -121,15 +121,16 @@ pub async fn create( let mut content = String::from(""); while let Some(chunk) = field.try_next().await? { content.push_str(std::str::from_utf8(&chunk).unwrap().to_string().as_str()); + } + if content.len() > 0 { + new_pasta.content = content; + new_pasta.pasta_type = if is_valid_url(new_pasta.content.as_str()) { String::from("url") } else { String::from("text") }; } - if content.len() > 0 { - new_pasta.content = content; - } continue; } "syntax-highlight" => {