Prevents a crash when a file can't be resolved on Android (#221)
This commit is contained in:
parent
c13124f9bb
commit
d94aaaac30
|
@ -1,3 +1,7 @@
|
||||||
|
## 1.6.3+2
|
||||||
|
* Fixes a crash on Android when a file has an id that can't be resolved and uses a name instead (#221);
|
||||||
|
* Minor fix on Go (Desktop) - Windows (thanks @marchellodev);
|
||||||
|
|
||||||
## 1.6.3+1
|
## 1.6.3+1
|
||||||
Addresses an issue with plugin calls on Go (Desktop) - Linux & Windows
|
Addresses an issue with plugin calls on Go (Desktop) - Linux & Windows
|
||||||
|
|
||||||
|
|
|
@ -71,14 +71,15 @@ public class FileUtils {
|
||||||
id = id.split(":")[1];
|
id = id.split(":")[1];
|
||||||
}
|
}
|
||||||
for (final String contentUriPrefix : contentUriPrefixesToTry) {
|
for (final String contentUriPrefix : contentUriPrefixesToTry) {
|
||||||
final Uri contentUri = ContentUris.withAppendedId(Uri.parse(contentUriPrefix), Long.valueOf(id));
|
|
||||||
try {
|
try {
|
||||||
|
final Uri contentUri = ContentUris.withAppendedId(Uri.parse(contentUriPrefix), Long.valueOf(id));
|
||||||
final String path = getDataColumn(context, contentUri, null, null);
|
final String path = getDataColumn(context, contentUri, null, null);
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
Log.e(TAG, "Something went wrong while retrieving document path: " + e.toString());
|
Log.e(TAG, "Something went wrong while retrieving document path: " + e.toString());
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# file_picker
|
# file_picker
|
||||||
|
|
||||||
This Go package implements the host-side of the Flutter [file_picker](https://github.com/miguelpruivo/plugins_flutter_file_picker) plugin.
|
This Go package implements the host-side of the Flutter [file_picker](https://github.com/miguelpruivo/flutter_file_picker) plugin.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
... other imports ....
|
... other imports ....
|
||||||
|
file_picker "github.com/miguelpruivo/flutter_file_picker/go"
|
||||||
file_picker "github.com/miguelpruivo/plugins_flutter_file_picker/go"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var options = []flutter.Option{
|
var options = []flutter.Option{
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package file_picker
|
package file_picker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/gen2brain/dlgs"
|
"github.com/gen2brain/dlgs"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
@ -21,9 +19,9 @@ func fileFilter(method string, extensions []string, size int, isMulti bool) (str
|
||||||
var i int
|
var i int
|
||||||
var filters = "Files ("
|
var filters = "Files ("
|
||||||
for i = 0 ; i<size ; i++ {
|
for i = 0 ; i<size ; i++ {
|
||||||
filters += `*.` extensions[i] + `,`
|
filters += `*.` + extensions[i] + `,`
|
||||||
}
|
}
|
||||||
filters += ")\x00*." + resolveType[1] + "\x00All Files (*.*)\x00*.*\x00\x00"
|
filters += ")"
|
||||||
return filters, nil
|
return filters, nil
|
||||||
default:
|
default:
|
||||||
return "", errors.New("unknown method")
|
return "", errors.New("unknown method")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: file_picker
|
name: file_picker
|
||||||
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
||||||
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
||||||
version: 1.6.3+1
|
version: 1.6.3+2
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
@ -9,7 +9,7 @@ dependencies:
|
||||||
flutter_plugin_android_lifecycle: ^1.0.6
|
flutter_plugin_android_lifecycle: ^1.0.6
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.0.0-dev.28.0 <3.0.0"
|
sdk: ">=2.0.0 <3.0.0"
|
||||||
flutter: ">=1.10.0 <2.0.0"
|
flutter: ">=1.10.0 <2.0.0"
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|
Loading…
Reference in New Issue