Skip to content

Commit

Permalink
Merge branch 'fix-pick-image-cache-path'
Browse files Browse the repository at this point in the history
  • Loading branch information
linyi102 committed Mar 6, 2024
2 parents f7b057a + 56311cb commit fec6a33
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/utils/image_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ class ImageUtil {
}

static String _removeRootDirPath(String path, String rootDirPath) {
String relativeImagePath = path;
// Android选择图片后会缓存在/data/user/<package_name>/cache/file_picker/目录下
final cacheNameRegExp = RegExp(r'^\/data\/user.*\/cache\/file_picker');
if (Platform.isAndroid && relativeImagePath.contains(cacheNameRegExp)) {
return relativeImagePath.replaceFirst(cacheNameRegExp, '');
}
return path.replaceFirst(rootDirPath, "");
}

Expand Down

0 comments on commit fec6a33

Please sign in to comment.