From 38f01db127269da1013f7289a257447e98e90160 Mon Sep 17 00:00:00 2001 From: TrianguloY Date: Sun, 18 Jun 2023 18:39:06 +0200 Subject: [PATCH] skip fully empty query parameters note that strings like '?=&' will be skipped too. and also strings like '?abc' will be converted to '?abc=' fixing these examples will require to implement a custom query parsing logic (or use the original from the query remover module) fixes #244 --- .../trianguloy/urlchecker/modules/list/UriPartsModule.java | 4 +++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/trianguloy/urlchecker/modules/list/UriPartsModule.java b/app/src/main/java/com/trianguloy/urlchecker/modules/list/UriPartsModule.java index 35a0f1c..a10305e 100644 --- a/app/src/main/java/com/trianguloy/urlchecker/modules/list/UriPartsModule.java +++ b/app/src/main/java/com/trianguloy/urlchecker/modules/list/UriPartsModule.java @@ -165,7 +165,8 @@ class UriPartsDialog extends AModuleDialog { if (value == null) return; var part = Inflater.inflate(R.layout.uri_part, container); - part.findViewById(R.id.key).setText(name); + part.findViewById(R.id.key) + .setText(name.isEmpty() ? getActivity().getString(R.string.mParts_empty) : name); var value_view = part.findViewById(R.id.value); value_view.setText(value); AndroidUtils.setAsClickable(value_view); @@ -192,6 +193,7 @@ class UriPartsDialog extends AModuleDialog { var queries = new ArrayList>(); for (var name : uri.getQueryParameterNames()) { for (var value : uri.getQueryParameters(name)) { + if (name.isEmpty() && value.isEmpty()) continue; // skip fully empty entries queries.add(Pair.create(name, value)); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 66d0dc8..005b458 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -322,4 +322,5 @@ With the button below you can edit the default state and the visibility of the f By clicking a part it will be set as the new url, useful for example if one of the queries or paths was an encoded redirection url. You can also click the 'X' button to remove some of them. This is an advanced version of the 'Queries Remover' module." + (empty) \ No newline at end of file