Fixing crash in file sharing
This commit is contained in:
parent
1ec45b7308
commit
5f8c711115
2 changed files with 5 additions and 7 deletions
|
@ -784,8 +784,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
private void sendImageMessage(String path, int imageSize) {
|
||||
if(path.contains("file://")) {
|
||||
path = path.split("file:///", 2)[1];
|
||||
} else if (path.contains("content://")){
|
||||
path = LinphoneUtils.getFilePath(this.getActivity().getApplicationContext(), Uri.parse(path));
|
||||
}
|
||||
if(path.contains("%20")) {
|
||||
if(path != null && path.contains("%20")) {
|
||||
path = path.replace("%20", "-");
|
||||
}
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
@ -844,7 +846,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
} else if (path.contains("content://")){
|
||||
path = LinphoneUtils.getFilePath(this.getActivity().getApplicationContext(), Uri.parse(path));
|
||||
}
|
||||
if(path.contains("%20")) {
|
||||
if(path != null && path.contains("%20")) {
|
||||
path = path.replace("%20", "-");
|
||||
}
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
|
|
@ -748,11 +748,7 @@ public final class LinphoneUtils {
|
|||
if ("com.android.externalstorage.documents".equals(uri.getAuthority())) {
|
||||
final String docId = DocumentsContract.getDocumentId(uri);
|
||||
final String[] split = docId.split(":");
|
||||
final String type = split[0];
|
||||
|
||||
if ("primary".equalsIgnoreCase(type)) {
|
||||
return Environment.getExternalStorageDirectory() + "/" + split[1];
|
||||
}
|
||||
if (split.length >= 1) return Environment.getExternalStorageDirectory() + "/" + split[1];
|
||||
|
||||
// TODO handle non-primary volumes
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue