Commit 9b44c7acbc
Unsigned
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 | 29 | } else { |
| 30 | 30 | // the id can come after "?v=" in an url |
| 31 | 31 | let index = if let Some(index) = identifier.find("?v=") { |
| 32 | if identifier.len() < index + 15 { | |
| 32 | if identifier.len() < index + 14 { | |
| 33 | 33 | return Err(format!("Cannot find video id from string `{identifier}`")); |
| 34 | 34 | } |
| 35 | 35 | index + 3 |
| 36 | 36 | // and also "youtu.be/" |
| 37 | 37 | } else if let Some(index) = identifier.find("youtu.be/") { |
| 38 | if identifier.len() < index + 21 { | |
| 38 | if identifier.len() < index + 20 { | |
| 39 | 39 | return Err(format!("Cannot find video id from string `{identifier}`")); |
| 40 | 40 | } |
| 41 | 41 | index + 9 |