You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by mo...@apache.org on 2019/04/01 02:20:07 UTC
[incubator-weex] branch master updated: [iOS] Fix cannot
display picture with url which contains Chinese words. (#2135)
This is an automated email from the ASF dual-hosted git repository.
moshen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new 2d98598 [iOS] Fix <image> cannot display picture with url which contains Chinese words. (#2135)
new 450a27c Merge pull request #2214 from NickeyLin/fix/image
2d98598 is described below
commit 2d985981a8f9b6ef2dbdf39f0357e5c660cd0116
Author: Nick.Lin <ti...@sina.com>
AuthorDate: Mon Mar 11 19:29:53 2019 +0800
[iOS] Fix <image> cannot display picture with url which contains Chinese words. (#2135)
---
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 65c50b4..ea3a915 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -766,8 +766,12 @@ typedef enum : NSUInteger {
if (!url) {
return nil;
}
-
- return [NSURL URLWithString:url relativeToURL:_scriptURL];
+ NSURL *result = [NSURL URLWithString:url relativeToURL:_scriptURL];
+ if (result) {
+ return result;
+ }
+ // if result is nil, try url-encode the 'url' string.
+ return [NSURL URLWithString:[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] relativeToURL:_scriptURL];
}
- (BOOL)checkModuleEventRegistered:(NSString*)event moduleClassName:(NSString*)moduleClassName