Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[weex][android] fix the custom file ttf not work well, need replace u…
Browse files Browse the repository at this point in the history
…ri.getPath() with (#1964)

like the doc said : with url('file://storage/emulated/0/A/B/**.ttf to custom font by file path, but the result of path format that will like emulated/0/A/B/**.ttf ,rather than storage/emulated/0/A/B/**.ttf which will cause File Not Found Exception. Because getPath format schema storage as authority , as you can see [scheme:][//authority][path][?query][#fragment]
  • Loading branch information
brucetoo authored and YorkShen committed Jan 9, 2019
1 parent 11523a3 commit 425e0a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ private void parseSrc(String src, WXSDKInstance instance) {
mType = TYPE_NETWORK;
} else if (Constants.Scheme.FILE.equals(scheme)) {
mType = TYPE_FILE;
mUrl = uri.getPath();
/**
* eg: file://name/A/B.ttf
* getPath() = "A/B.ttf",but the real absolute path is "/name/A/B.ttf"
* so use getEncodedSchemeSpecificPart() to replaced = "//name/A/B.ttf"
*/
mUrl = uri.getEncodedSchemeSpecificPart();
} else if (Constants.Scheme.LOCAL.equals(scheme)){
mType = TYPE_LOCAL;
} else if (Constants.Scheme.DATA.equals(scheme)) {
Expand Down

0 comments on commit 425e0a9

Please sign in to comment.