From a7b2b53c46d49f28dbe31174136871fc3f74da27 Mon Sep 17 00:00:00 2001 From: Pablo Ortigosa <55493443+PabloOQ@users.noreply.github.com> Date: Mon, 9 May 2022 00:11:26 +0100 Subject: [PATCH] Fixed null when there is no authority Added additional comments. --- .../urlchecker/modules/list/RemoveQueriesModule.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/trianguloy/urlchecker/modules/list/RemoveQueriesModule.java b/app/src/main/java/com/trianguloy/urlchecker/modules/list/RemoveQueriesModule.java index 1bdc810..8e87ae8 100644 --- a/app/src/main/java/com/trianguloy/urlchecker/modules/list/RemoveQueriesModule.java +++ b/app/src/main/java/com/trianguloy/urlchecker/modules/list/RemoveQueriesModule.java @@ -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) { }