Skip to content

Commit 5438111

Browse files
author
ironholds
committed
Fix #18
1 parent 4f66c33 commit 5438111

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

NEWS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ Version 1.2.0 [WIP]
22
-------------------------------------------------------------------------
33

44
NEW FEATURES
5-
*Jay Jacobs' "tldextract" functionality has been merged with urltools, and can be accessed
5+
* Jay Jacobs' "tldextract" functionality has been merged with urltools, and can be accessed
66
with "suffix_extract"
77

8+
BUG FIXES
9+
10+
* A bug in which fragments could not be retrieved (and were incorrectly identified as parameters)
11+
has been fixed. Thanks to Nicolas Coutin for reporting it and providing a reproducible example.
12+
813
Version 1.1.1
914
-------------------------------------------------------------------------
1015
BUG FIXES

src/parsing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ std::string parsing::path(std::string& url){
4949
return output;
5050
}
5151
output = url.substr(0,fragment);
52-
url = url.substr(fragment+1);
52+
url = url.substr(fragment);
5353
return output;
5454
}
5555

tests/testthat/test_parsing.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ test_that("Check parsing can handle missing elements", {
2626
expect_that(data$fragment[1], equals("ending"))
2727
})
2828

29+
test_that("Parsing does not up and die and misplace the fragment",{
30+
data <- url_parse("http://www.yeastgenome.org/locus/S000005366/overview#protein")
31+
expect_that(data$fragment[1], equals("protein"))
32+
})
33+
2934
test_that("Parameter parsing can handle multiple, non-existent and pre-trailing parameters",{
3035
urls <- c("https://www.google.com:80/foo.php?api_params=parsable&this_parameter=selfreferencing&hiphop=awesome",
3136
"https://www.google.com:80/foo.php?api_params=parsable&this_parameter=selfreferencing&hiphop=awesome#foob",
@@ -39,4 +44,5 @@ test_that("Parameter parsing works where the parameter appears earlier in the UR
3944
url <- url_parameters("www.housetrip.es/tos-de-vacaciones/geo?from=01/04/2015&guests=4&to=05/04/2015","to")
4045
expect_that(ncol(url), equals(1))
4146
expect_that(url$to[1], equals("05/04/2015"))
42-
})
47+
})
48+

0 commit comments

Comments
 (0)