Fix NumberFormatException in PCAP open / CSV export

This commit is contained in:
emanuele-f 2023-08-29 22:37:41 +02:00
parent 63eab62222
commit 263d1dfefe

View File

@ -1690,13 +1690,20 @@ public class Utils {
if (id.startsWith("raw:/")) {
return Uri.parse(id).getPath();
} else {
long id_long;
try {
id_long = Long.parseLong(id);
} catch (NumberFormatException ignored) {
return null;
}
String[] contentUriPrefixesToTry = new String[]{
"content://downloads/public_downloads",
"content://downloads/my_downloads"
};
for (String contentUriPrefix : contentUriPrefixesToTry) {
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse(contentUriPrefix), Long.parseLong(id));
Uri.parse(contentUriPrefix), id_long);
String path = mediastoreUriToPath(ctx, contentUri);
if(path != null)
return path;