From c5dbeb53c9287c6908fa1b8e43b37120817ccfa2 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 21 Nov 2016 15:43:20 -0800 Subject: [PATCH] Don't go out of bounds when slicing (fixes #241) --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5d9de680..89e08c3c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -498,7 +498,7 @@ impl Url { /// as is typically the case of `data:` and `mailto:` URLs. #[inline] pub fn cannot_be_a_base(&self) -> bool { - self.byte_at(self.path_start) != b'/' + !self.slice(self.path_start..).starts_with('/') } /// Return the username for this URL (typically the empty string)