0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-19 20:02:16 +02:00

Fixed null when there is no authority

Added additional comments.
This commit is contained in:
Pablo Ortigosa 2022-05-09 00:11:26 +01:00
parent ea0a20ddfe
commit a7b2b53c46

View File

@ -71,12 +71,18 @@ class RemoveQueriesDialog extends AModuleDialog implements View.OnClickListener
URL urlObject = null;
try {
urlObject = new URL(url);
//retrieve all components
String protocol = urlObject.getProtocol();
protocol = protocol + ":";
String authority = urlObject.getAuthority();
authority = authority != null ? "//" + authority : "";
String path = urlObject.getPath();
String ref = urlObject.getRef();
ref = ref != null ? "#" + ref : "";
cleared = protocol + "://" + authority + path + ref;
//create the url but without queries
cleared = protocol + authority + path + ref;
} catch (MalformedURLException e) {
}