FastHub
FastHub copied to clipboard
fix: add logic for replace html escaped symbols in uri string.
Hi folks. I investigated the problem with issue https://github.com/k0shk0sh/FastHub/issues/2890 The problem happens when extract URL from Html node, where & present as & (by 'net.sourceforge.htmlcleaner:htmlcleaner:2.2'). It normal display in TextView. Uri.parse() not converted this escaped symbol and try open page with it. I not sure, this solution is best, but it resolves the problem.
how about oppo a91
how about oppo a91
I don't clear understand you. Can you explain you comment more details?
Looks like a code smell to me! I would suggest editing LinkParseHelper
file to include a static hashmap of all escape symbol & a helper function to remove them all.
A pseudo-code is given below.
public class LinkParserHelper {
...
static final Map<String, String> escapeSymbols = ...
public static String removeEscapeSymbols(String url) {
for(Map.Entry<String, String> value : escapeSymbols.entrySet()) {
url = url.replace(value.getKey(), value.getValue());
}
return url;
}
}
The only problem is the LinkParseHelper
class in written in java
so the code must be in java
. Anyway, you can then call the static function at the appropriate call site.
looks like a code to me
On Thu, Nov 12, 2020, 13:06 Kaustubh Patange [email protected] wrote:
Looks like a code smell to me! I would suggest editing LinkParseHelper https://github.com/k0shk0sh/FastHub/blob/development/app/src/main/java/com/fastaccess/provider/scheme/LinkParserHelper.java file to include a static hashmap of all escape symbol & a helper function to remove them all.
A pseudo-code is given below.
public class LinkParserHelper { ... static final Map<String, String> escapeSymbols = ...
public static String removeEscapeSymbols(String url) { for(Map.Entry<String, String> value : escapeSymbols.entrySet()) { url = url.replace(value.getKey(), value.getValue()); } return url; }
}
The only problem is the LinkParseHelper class in written in java so the code must be in java. Anyway, you can then call the static function at the appropriate call site.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/k0shk0sh/FastHub/pull/2899#issuecomment-726037569, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ3EC5ZDNLYMJYGXIIIEPGTSPPFVBANCNFSM4ML6ZOJQ .