Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions QiniuSDK/QiniuResumableClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,13 @@ - (void)mkfile:(NSString *)key
{

NSString *mimeStr = extra.mimeType == nil ? @"" : [[NSString alloc] initWithFormat:@"/mimetype/%@", [QiniuResumableClient encode:extra.mimeType]];
NSString *keyStr = [[NSString alloc] initWithFormat:@"/key/%@", [QiniuResumableClient encode:key]];
NSString *callUrl = [[NSString alloc] initWithFormat:@"%@/mkfile/%u%@%@", kQiniuUpHost, (unsigned int)fileSize, mimeStr, keyStr];

NSString *callUrl = [[NSString alloc] initWithFormat:@"%@/mkfile/%u%@", kQiniuUpHost, (unsigned int)fileSize, mimeStr];

if (key != nil) {
NSString *keyStr = [[NSString alloc] initWithFormat:@"/key/%@", [QiniuResumableClient encode:key]];
callUrl = [NSString stringWithFormat:@"%@%@", callUrl, keyStr];
}

if (extra.params != nil) {
NSEnumerator *e = [extra.params keyEnumerator];
Expand Down
13 changes: 12 additions & 1 deletion QiniuSDKTests/QiniuSDKTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ - (void)setUp
// Prepare the uptoken
// token with a year, 14.2.23
_token = @"6UOyH0xzsnOF-uKmsHgpi7AhGWdfvI8glyYV3uPg:m-8jeXMWC-4kstLEHEMCfZAZnWc=:eyJkZWFkbGluZSI6MTQyNDY4ODYxOCwic2NvcGUiOiJ0ZXN0MzY5In0=";

_done = false;
_progressReceived = false;
}
Expand Down Expand Up @@ -171,6 +171,17 @@ - (void)testResumableUploadSmall
XCTAssertEqual(_succeed, YES, "ResumableUpload failed, error: %@", _error);
}

- (void)testResumableUploadWithoutKey
{
QiniuResumableUploader *uploader = [[QiniuResumableUploader alloc] initWithToken:_token];
uploader.delegate = self;

NSLog(@"resumable upload");
[uploader uploadFile:_filePath key:nil extra:nil];
[self waitFinish];
XCTAssertEqual(_succeed, YES, "ResumableUpload failed, error: %@", _error);
}

// */

- (void)testResumableUploadWithParam
Expand Down