Skip to content

Commit eb4927f

Browse files
committed
文件下载 bugfix
1 parent 3a92911 commit eb4927f

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

Coding_iOS/Coding_Enterprise_iOS-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>2.9.6</string>
20+
<string>2.9.7</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleURLTypes</key>
@@ -28,7 +28,7 @@
2828
</dict>
2929
</array>
3030
<key>CFBundleVersion</key>
31-
<string>2.9.6.20180712.1</string>
31+
<string>2.9.7.20181022.1</string>
3232
<key>ITSAppUsesNonExemptEncryption</key>
3333
<false/>
3434
<key>LSApplicationQueriesSchemes</key>

Coding_iOS/Coding_iOS-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>5.4.1</string>
20+
<string>5.4.2</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleURLTypes</key>
@@ -37,7 +37,7 @@
3737
</dict>
3838
</array>
3939
<key>CFBundleVersion</key>
40-
<string>5.4.1.20180712.1</string>
40+
<string>5.4.2.20181022.1</string>
4141
<key>ITSAppUsesNonExemptEncryption</key>
4242
<false/>
4343
<key>LSApplicationQueriesSchemes</key>

Coding_iOS/Models/ProjectFile.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ - (NSString *)storage_key_for_disk{
138138
if (fileNameCom.count > 1 && storage_keyCom.count > 0 && ![fileNameCom.lastObject isEqualToString:storage_keyCom.lastObject]) {//_storage_key 后缀名与 fileNameCom 后缀名不同的情况
139139
[storage_keyCom addObject:fileNameCom.lastObject];
140140
return [storage_keyCom componentsJoinedByString:@"."];
141-
}else{
141+
}else if (_storage_key.length > 0){
142142
return [_storage_key componentsSeparatedByString:@"/"].lastObject;//'group0/M00/00/01/fwAAAVsHsvqAOY8rABzvMF5h1Ck652.JPG'..诡异的前半截数据
143+
}else{// 说是以后,可能迁移到腾讯云,_storage_key 字段可能不保
144+
return [NSString stringWithFormat:@"%@_%@.%@", _project_id, _file_id, fileNameCom.lastObject];
143145
}
144146
}
145147

Coding_iOS/Util/Manager/Coding_FileManager.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ + (NSString *)keyStrFromResponse:(NSURLResponse *)response{
139139
if (!response) {
140140
return nil;
141141
}
142-
NSString *keyStr = response.URL.absoluteString;
143-
keyStr = [[[[keyStr componentsSeparatedByString:@"?download"] firstObject] componentsSeparatedByString:@"/"] lastObject];
142+
NSString *keyStr = [response.URL.path componentsSeparatedByString:@"/"].lastObject;
144143
return keyStr;
145144
}
146145
+ (Coding_DownloadTask *)cDownloadTaskForResponse:(NSURLResponse *)response{
@@ -173,7 +172,7 @@ - (Coding_DownloadTask *)addDownloadTaskWithPath:(NSString *)downloadPath
173172
NSURLRequest *request = [NSURLRequest requestWithURL:downloadURL];
174173
NSURLSessionDownloadTask *downloadTask = [self.af_manager downloadTaskWithRequest:request progress:&progress destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
175174
NSURL *downloadUrl = [[Coding_FileManager sharedManager] urlForDownloadFolder];
176-
Coding_DownloadTask *cDownloadTask = [Coding_FileManager cDownloadTaskForResponse:response];
175+
Coding_DownloadTask *cDownloadTask = [Coding_FileManager cDownloadTaskForKey:storage_key] ?: [Coding_FileManager cDownloadTaskForResponse:response];
177176
if (cDownloadTask) {
178177
downloadUrl = [downloadUrl URLByAppendingPathComponent:cDownloadTask.diskFileName];
179178
}else{

Coding_iOS/Views/FileDownloadView.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ - (void)loadLayoutWithCurFile{
123123
_toolBarView.backgroundColor = kColorTableSectionBg;
124124
[self addSubview:_toolBarView];
125125
[_toolBarView mas_makeConstraints:^(MASConstraintMaker *make) {
126-
make.left.right.bottom.equalTo(self);
126+
make.left.right.equalTo(self);
127+
make.bottom.equalTo(self).offset(-kSafeArea_Bottom);
127128
make.height.mas_equalTo(49);
128129
}];
129130
}

0 commit comments

Comments
 (0)