aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Evan Shreve <jacob@shreve.io>2019-05-19 15:24:00 -0400
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-05-19 19:24:00 +0000
commit29c037e3c5601731b7ec0e9555bd09fe5531bd05 (patch)
tree81552ae5fcf5f3d6e299825fe55bf143f5e651d8
parent679b15e2749c600950af6dc8386990a5dfedfd0f (diff)
downloadalacritty-29c037e3c5601731b7ec0e9555bd09fe5531bd05.tar.gz
alacritty-29c037e3c5601731b7ec0e9555bd09fe5531bd05.zip
Allow URLs to end with trailing slash
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty_terminal/src/url.rs7
2 files changed, 5 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b902ebba..1e0d9fdd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Selections not automatically expanding across double-width characters
- On macOS, automatic graphics switching has been enabled again
- Text getting recognized as URLs without slashes separating the scheme
+- URL parser dropping trailing slashes from valid URLs
### Removed
diff --git a/alacritty_terminal/src/url.rs b/alacritty_terminal/src/url.rs
index 7f47e12d..b10f2421 100644
--- a/alacritty_terminal/src/url.rs
+++ b/alacritty_terminal/src/url.rs
@@ -18,7 +18,7 @@ use crate::term::cell::{Cell, Flags};
// See https://tools.ietf.org/html/rfc3987#page-13
const URL_SEPARATOR_CHARS: [char; 10] = ['<', '>', '"', ' ', '{', '}', '|', '\\', '^', '`'];
-const URL_DENY_END_CHARS: [char; 8] = ['.', ',', ';', ':', '?', '!', '/', '('];
+const URL_DENY_END_CHARS: [char; 7] = ['.', ',', ';', ':', '?', '!', '('];
const URL_SCHEMES: [&str; 8] =
["http://", "https://", "mailto:", "news:", "file://", "git://", "ssh://", "ftp://"];
@@ -245,11 +245,11 @@ mod tests {
url_test(")https://example.org(", "https://example.org");
url_test("https://example.org)", "https://example.org");
url_test("https://example.org(", "https://example.org");
- url_test("(https://one.org/)(https://two.org/)", "https://one.org");
+ url_test("(https://one.org/)(https://two.org/)", "https://one.org/");
url_test("https://[2001:db8:a0b:12f0::1]:80", "https://[2001:db8:a0b:12f0::1]:80");
url_test("([(https://example.org/test(ing))])", "https://example.org/test(ing)");
- url_test("https://example.org/]()", "https://example.org");
+ url_test("https://example.org/]()", "https://example.org/");
url_test("[https://example.org]", "https://example.org");
url_test("'https://example.org/test'ing'''", "https://example.org/test'ing'");
@@ -276,6 +276,7 @@ mod tests {
url_test("https://example.org/test?ing", "https://example.org/test?ing");
url_test("https://example.org.,;:)'!/?", "https://example.org");
url_test("https://example.org'.", "https://example.org");
+ url_test("https://example.org/test/?;:", "https://example.org/test/");
}
#[test]