Commit 9b44c7acbc

9b44c7acbc5cd0084dc2ad1ab2b6a680d01ea667

parent: ca66396c59

Unsigned

siriusmart <siriusmart@tuta.io> · 2025-08-11 15:52 UTC

#88, weird

Layout: unified · split

src/global/functions/from_url.rs +2 −2
@@ -29,13 +29,13 @@ pub fn from_video_url(identifier: &str) -> Result<String, String> {
29 } else { 29 } else {
30 // the id can come after "?v=" in an url 30 // the id can come after "?v=" in an url
31 let index = if let Some(index) = identifier.find("?v=") { 31 let index = if let Some(index) = identifier.find("?v=") {
32 if identifier.len() < index + 15 { 32 if identifier.len() < index + 14 {
33 return Err(format!("Cannot find video id from string `{identifier}`")); 33 return Err(format!("Cannot find video id from string `{identifier}`"));
34 } 34 }
35 index + 3 35 index + 3
36 // and also "youtu.be/" 36 // and also "youtu.be/"
37 } else if let Some(index) = identifier.find("youtu.be/") { 37 } else if let Some(index) = identifier.find("youtu.be/") {
38 if identifier.len() < index + 21 { 38 if identifier.len() < index + 20 {
39 return Err(format!("Cannot find video id from string `{identifier}`")); 39 return Err(format!("Cannot find video id from string `{identifier}`"));
40 } 40 }
41 index + 9 41 index + 9