Fixed a bug that caused url pastas to become plain text pastas
This commit is contained in:
parent
ca1cd91635
commit
5e1fcff979
1 changed files with 4 additions and 3 deletions
|
@ -121,15 +121,16 @@ pub async fn create(
|
||||||
let mut content = String::from("");
|
let mut content = String::from("");
|
||||||
while let Some(chunk) = field.try_next().await? {
|
while let Some(chunk) = field.try_next().await? {
|
||||||
content.push_str(std::str::from_utf8(&chunk).unwrap().to_string().as_str());
|
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()) {
|
new_pasta.pasta_type = if is_valid_url(new_pasta.content.as_str()) {
|
||||||
String::from("url")
|
String::from("url")
|
||||||
} else {
|
} else {
|
||||||
String::from("text")
|
String::from("text")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if content.len() > 0 {
|
|
||||||
new_pasta.content = content;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
"syntax-highlight" => {
|
"syntax-highlight" => {
|
||||||
|
|
Loading…
Reference in a new issue