fix(reddit/sanitize-sharing-links): update patch to support latest app version (#430)

This commit is contained in:
LisoUseInAIKyrios 2023-07-03 23:29:04 +04:00 committed by GitHub
parent e9f797824e
commit d947de2e03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,25 +0,0 @@
package app.revanced.reddit.patches;
import app.revanced.integrations.utils.LogHelper;
import java.net.MalformedURLException;
import java.net.URL;
public final class SanitizeUrlQueryPatch {
/**
* Strip query parameters from a given URL string.
*
* @param urlString URL string to strip query parameters from.
* @return URL string without query parameters if possible, otherwise the original string.
*/
public static String stripQueryParameters(final String urlString) {
try {
final var url = new URL(urlString);
return url.getProtocol() + "://" + url.getHost() + url.getPath();
} catch (MalformedURLException e) {
LogHelper.printException(() -> "Can not parse URL", e);
return urlString;
}
}
}