Skip to content

Commit

Permalink
chore: remove sensitive url from log
Browse files Browse the repository at this point in the history
  • Loading branch information
cinit committed Sep 21, 2024
1 parent 14631b9 commit 44a4b29
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/src/main/java/cc/ioctl/hook/chat/BlockFluxThief.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
import java.util.Objects;
Expand Down Expand Up @@ -116,13 +117,24 @@ protected boolean initOnce() throws Exception {
// TODO: 2021-1-9 Unknown size, do nothing?
}
} catch (IOException e) {
Log.d("BlockFluxThief/Req " + e + " URL=" + url);
Log.d("BlockFluxThief/Req " + e + " URL=" + filterUrlForLog(url));
}
}
});
return true;
}

private static String filterUrlForLog(String url) {
// keep scheme and host and port
URL u;
try {
u = new URL(url);
} catch (MalformedURLException e) {
return url;
}
return u.getProtocol() + "://" + u.getHost() + (u.getPort() == -1 ? "" : ":" + u.getPort()) + "/...";
}

@NonNull
@Override
public String[] getUiItemLocation() {
Expand Down

0 comments on commit 44a4b29

Please sign in to comment.