Skip to content

Commit b7589da

Browse files
committed
bugfix
1 parent f785a96 commit b7589da

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Coding_iOS/Util/OC_Category/NSString+Common.m

+5-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ - (NSURL *)urlWithCodePath{
7979
return nil;
8080
}else{
8181
if (![self hasPrefix:@"http"]) {
82-
urlStr = [NSString stringWithFormat:@"%@%@", [NSObject baseURLStr], self];
82+
urlStr = [NSString stringWithFormat:@"%@%@", [NSObject baseURLStr], [self hasPrefix:@"/"]? [self substringFromIndex:1]: self];
8383
}else{
8484
urlStr = self;
8585
}
@@ -97,11 +97,14 @@ - (NSURL *)urlImageWithCodePathResize:(CGFloat)width crop:(BOOL)needCrop{
9797
}else{
9898
if (![self hasPrefix:@"http"]) {
9999
NSString *imageName = [self stringByMatching:@"/static/fruit_avatar/([a-zA-Z0-9\\-._]+)$" capture:1];
100+
if (!imageName) {
101+
imageName = [self stringByMatching:@"/static/project_icon/([a-zA-Z0-9\\-._]+)$" capture:1];
102+
}
100103
if (imageName && imageName.length > 0) {
101104
urlStr = [NSString stringWithFormat:@"http://coding-net-avatar.qiniudn.com/%@?imageMogr2/auto-orient/thumbnail/!%.0fx%.0fr", imageName, width, width];
102105
canCrop = YES;
103106
}else{
104-
urlStr = [NSString stringWithFormat:@"%@%@", [NSObject baseURLStr], self];
107+
urlStr = [NSString stringWithFormat:@"%@%@", [NSObject baseURLStr], [self hasPrefix:@"/"]? [self substringFromIndex:1]: self];
105108
}
106109
}else{
107110
urlStr = self;

0 commit comments

Comments
 (0)