From 9da9731f921f8fdb929be639adda79858a91ffc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sat, 19 Aug 2023 12:41:53 +0000 Subject: [PATCH] Fix typos --- lychee-lib/src/utils/request.rs | 2 +- lychee-lib/src/utils/url.rs | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lychee-lib/src/utils/request.rs b/lychee-lib/src/utils/request.rs index f092b72b1c..70f82ce1d8 100644 --- a/lychee-lib/src/utils/request.rs +++ b/lychee-lib/src/utils/request.rs @@ -131,7 +131,7 @@ fn construct_url(base: &Option, text: &str) -> Option> { } fn create_uri_from_path(src: &Path, dst: &str, base: &Option) -> Result> { - let (dst, frag) = url::remove_get_params_and_seperate_fragment(dst); + let (dst, frag) = url::remove_get_params_and_separate_fragment(dst); // Avoid double-encoding already encoded destination paths by removing any // potential encoding (e.g. `web%20site` becomes `web site`). // That's because Url::from_file_path will encode the full URL in the end. diff --git a/lychee-lib/src/utils/url.rs b/lychee-lib/src/utils/url.rs index 4eb40f76bb..c27f0a0202 100644 --- a/lychee-lib/src/utils/url.rs +++ b/lychee-lib/src/utils/url.rs @@ -4,9 +4,9 @@ use once_cell::sync::Lazy; static LINK_FINDER: Lazy = Lazy::new(LinkFinder::new); -/// Remove all GET parameters from a URL and seperates out the fragment. +/// Remove all GET parameters from a URL and separates out the fragment. /// The link is not a URL but a String as it may not have a base domain. -pub(crate) fn remove_get_params_and_seperate_fragment(url: &str) -> (&str, Option<&str>) { +pub(crate) fn remove_get_params_and_separate_fragment(url: &str) -> (&str, Option<&str>) { let (path, frag) = match url.split_once('#') { Some((path, fragment)) => (path, Some(fragment)), None => (url, None), @@ -29,48 +29,48 @@ mod test_fs_tree { #[test] fn test_remove_get_params_and_fragment() { - assert_eq!(remove_get_params_and_seperate_fragment("/"), ("/", None)); + assert_eq!(remove_get_params_and_separate_fragment("/"), ("/", None)); assert_eq!( - remove_get_params_and_seperate_fragment("index.html?foo=bar"), + remove_get_params_and_separate_fragment("index.html?foo=bar"), ("index.html", None) ); assert_eq!( - remove_get_params_and_seperate_fragment("/index.html?foo=bar"), + remove_get_params_and_separate_fragment("/index.html?foo=bar"), ("/index.html", None) ); assert_eq!( - remove_get_params_and_seperate_fragment("/index.html?foo=bar&baz=zorx?bla=blub"), + remove_get_params_and_separate_fragment("/index.html?foo=bar&baz=zorx?bla=blub"), ("/index.html", None) ); assert_eq!( - remove_get_params_and_seperate_fragment("https://example.com/index.html?foo=bar"), + remove_get_params_and_separate_fragment("https://example.com/index.html?foo=bar"), ("https://example.com/index.html", None) ); assert_eq!( - remove_get_params_and_seperate_fragment("test.png?foo=bar"), + remove_get_params_and_separate_fragment("test.png?foo=bar"), ("test.png", None) ); assert_eq!( - remove_get_params_and_seperate_fragment("https://example.com/index.html#anchor"), + remove_get_params_and_separate_fragment("https://example.com/index.html#anchor"), ("https://example.com/index.html", Some("anchor")) ); assert_eq!( - remove_get_params_and_seperate_fragment( + remove_get_params_and_separate_fragment( "https://example.com/index.html?foo=bar#anchor" ), ("https://example.com/index.html", Some("anchor")) ); assert_eq!( - remove_get_params_and_seperate_fragment("test.png?foo=bar#anchor"), + remove_get_params_and_separate_fragment("test.png?foo=bar#anchor"), ("test.png", Some("anchor")) ); assert_eq!( - remove_get_params_and_seperate_fragment("test.png#anchor?anchor!?"), + remove_get_params_and_separate_fragment("test.png#anchor?anchor!?"), ("test.png", Some("anchor?anchor!?")) ); assert_eq!( - remove_get_params_and_seperate_fragment("test.png?foo=bar#anchor?anchor!"), + remove_get_params_and_separate_fragment("test.png?foo=bar#anchor?anchor!"), ("test.png", Some("anchor?anchor!")) ); }