mirror of
https://github.com/little-snow-fox/react-native-wechat-lib.git
synced 2025-12-06 15:26:49 +08:00
feat 添加预防代码,预防安卓 shareLocalImage 参数被传入 file 开头的路径
This commit is contained in:
parent
b9524ca994
commit
0764841ccb
@ -250,7 +250,11 @@ public class WeChatModule extends ReactContextBaseJavaModule implements IWXAPIEv
|
|||||||
public void shareLocalImage(final ReadableMap data, final Callback callback) {
|
public void shareLocalImage(final ReadableMap data, final Callback callback) {
|
||||||
FileInputStream fs = null;
|
FileInputStream fs = null;
|
||||||
try {
|
try {
|
||||||
fs = new FileInputStream(data.getString("imageUrl"));
|
String path = data.getString("imageUrl");
|
||||||
|
if (path.indexOf("file://") > -1) {
|
||||||
|
path = path.substring(7);
|
||||||
|
}
|
||||||
|
fs = new FileInputStream(path);
|
||||||
Bitmap bmp = BitmapFactory.decodeStream(fs);
|
Bitmap bmp = BitmapFactory.decodeStream(fs);
|
||||||
// 初始化 WXImageObject 和 WXMediaMessage 对象
|
// 初始化 WXImageObject 和 WXMediaMessage 对象
|
||||||
WXImageObject imgObj = new WXImageObject(bmp);
|
WXImageObject imgObj = new WXImageObject(bmp);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user