Merge pull request 'Fix bug where url fragments were considered path elements' (#89) from master into release

Reviewed-on: https://git.marginalia.nu/marginalia/marginalia.nu/pulls/89
This commit is contained in:
Viktor Lofgren 2022-08-18 16:48:48 +02:00
commit 4435334ebe
2 changed files with 11 additions and 1 deletions

View File

@ -34,7 +34,7 @@ public class EdgeUrl implements WideHashable {
public static String urlencodeFixer(String url) throws URISyntaxException {
var s = new StringBuilder();
String goodChars = "&.?:/-;+$";
String goodChars = "&.?:/-;+$#";
String hexChars = "0123456789abcdefABCDEF";
int pathIdx = findPathIdx(url);

View File

@ -4,12 +4,22 @@ import org.junit.jupiter.api.Test;
import java.net.URISyntaxException;
import static org.junit.jupiter.api.Assertions.assertEquals;
class EdgeUrlTest {
@Test
public void testHashCode() throws URISyntaxException {
System.out.println(new EdgeUrl("https://memex.marginalia.nu").hashCode());
}
@Test
public void testFragment() throws URISyntaxException {
assertEquals(
new EdgeUrl("https://memex.marginalia.nu/"),
new EdgeUrl("https://memex.marginalia.nu/#here")
);
}
@Test
public void testParam() throws URISyntaxException {
System.out.println(new EdgeUrl("https://memex.marginalia.nu/index.php?id=1").toString());