Fixed a bug that caused url pastas to become plain text pastas

This commit is contained in:
Daniel Szabo 2022-11-07 20:25:42 +02:00
parent ca1cd91635
commit 5e1fcff979

View file

@ -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" => {