Skip to content

Commit

Permalink
Merge pull request #101 from jackyding2679/bug-fix
Browse files Browse the repository at this point in the history
fix bug
  • Loading branch information
jackyding2679 authored Feb 15, 2022
2 parents 0ef965a + 1b33317 commit f1afd5f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/op/object_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,6 @@ CosResult ObjectOp::ResumableGetObject(const MultiGetObjectReq& req,
CosResult head_result;
// 1. 调用HeadObject获取文件长度
HeadObjectReq head_req(req.GetBucketName(), req.GetObjectName());
;
HeadObjectResp head_resp;
head_result = HeadObject(head_req, &head_resp);
if (!head_result.IsSucc()) {
Expand All @@ -1794,7 +1793,7 @@ CosResult ObjectOp::ResumableGetObject(const MultiGetObjectReq& req,

std::string dir_name = FileUtil::GetDirectory(req.GetLocalFilePath());
std::string resumable_task_json_file =
dir_name + req.GetObjectName() + kResumableDownloadTaskFileSuffix;
dir_name + "/" + req.GetObjectName() + kResumableDownloadTaskFileSuffix;

std::map<std::string, std::string> resume_task_check_element = {
{kResumableDownloadTaskLastModified, head_resp.GetLastModified()},
Expand Down Expand Up @@ -1865,20 +1864,20 @@ CosResult ObjectOp::ResumableGetObject(const MultiGetObjectReq& req,
#if defined(_WIN32)
// The _O_BINARY is need by windows otherwise the x0A might change into x0D
// x0A
int fd = open(local_path.c_str(), _O_BINARY | O_WRONLY | O_CREAT | O_APPEND,
fd = open(local_path.c_str(), _O_BINARY | O_WRONLY | O_CREAT | O_APPEND,
_S_IREAD | _S_IWRITE);
#else
int fd = open(local_path.c_str(), O_WRONLY | O_CREAT | O_APPEND,
fd = open(local_path.c_str(), O_WRONLY | O_CREAT | O_APPEND,
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
#endif
} else {
#if defined(_WIN32)
// The _O_BINARY is need by windows otherwise the x0A might change into x0D
// x0A
int fd = open(local_path.c_str(), _O_BINARY | O_WRONLY | O_CREAT | O_TRUNC,
fd = open(local_path.c_str(), _O_BINARY | O_WRONLY | O_CREAT | O_TRUNC,
_S_IREAD | _S_IWRITE);
#else
int fd = open(local_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC,
fd = open(local_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC,
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
#endif
}
Expand Down

0 comments on commit f1afd5f

Please sign in to comment.