mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-05 18:25:31 +08:00
Fixed: Do not open null or empty file paths passed to TermuxOpenReceiver
This commit is contained in:
@@ -14,6 +14,7 @@ import android.provider.MediaStore;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import com.termux.app.utils.PluginUtils;
|
||||
import com.termux.shared.data.DataUtils;
|
||||
import com.termux.shared.data.IntentUtils;
|
||||
import com.termux.shared.net.uri.UriUtils;
|
||||
import com.termux.shared.logger.Logger;
|
||||
@@ -74,6 +75,10 @@ public class TermuxOpenReceiver extends BroadcastReceiver {
|
||||
|
||||
// Get full path including fragment (anything after last "#")
|
||||
String filePath = UriUtils.getUriFilePathWithFragment(data);
|
||||
if (DataUtils.isNullOrEmpty(filePath)) {
|
||||
Logger.logError(LOG_TAG, "filePath is null or empty");
|
||||
return;
|
||||
}
|
||||
|
||||
final File fileToShare = new File(filePath);
|
||||
if (!(fileToShare.isFile() && fileToShare.canRead())) {
|
||||
|
Reference in New Issue
Block a user