mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-02-02 18:48:26 +00:00
Fixed a bug issue #40
This commit is contained in:
parent
08929696f7
commit
c1a6d76fc3
16
src/s3fs.cpp
16
src/s3fs.cpp
@ -2272,8 +2272,20 @@ static int list_bucket(const char* path, S3ObjList& head, const char* delimiter)
|
||||
next_marker = (char*)tmpch;
|
||||
xmlFree(tmpch);
|
||||
}else{
|
||||
DPRN("Could not find next marker, thus break loop.");
|
||||
truncated = false;
|
||||
// If did not specify "delimiter", s3 did not return "NextMarker".
|
||||
// On this case, can use lastest name for next marker.
|
||||
//
|
||||
string lastname;
|
||||
if(!head.GetLastName(lastname)){
|
||||
DPRN("Could not find next marker, thus break loop.");
|
||||
truncated = false;
|
||||
}else{
|
||||
next_marker = s3_realpath.substr(1);
|
||||
if(0 == s3_realpath.length() || '/' != s3_realpath[s3_realpath.length() - 1]){
|
||||
next_marker += "/";
|
||||
}
|
||||
next_marker += lastname;
|
||||
}
|
||||
}
|
||||
}
|
||||
S3FS_XMLFREEDOC(doc);
|
||||
|
@ -229,6 +229,26 @@ bool S3ObjList::IsDir(const char* name) const
|
||||
return ps3obj->is_dir;
|
||||
}
|
||||
|
||||
bool S3ObjList::GetLastName(std::string& lastname) const
|
||||
{
|
||||
bool result = false;
|
||||
lastname = "";
|
||||
for(s3obj_t::const_iterator iter = objects.begin(); iter != objects.end(); iter++){
|
||||
if((*iter).second.orgname.length()){
|
||||
if(0 > strcmp(lastname.c_str(), (*iter).second.orgname.c_str())){
|
||||
lastname = (*iter).second.orgname;
|
||||
result = true;
|
||||
}
|
||||
}else{
|
||||
if(0 > strcmp(lastname.c_str(), (*iter).second.normalname.c_str())){
|
||||
lastname = (*iter).second.normalname;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool S3ObjList::GetNameList(s3obj_list_t& list, bool OnlyNormalized, bool CutSlash) const
|
||||
{
|
||||
s3obj_t::const_iterator iter;
|
||||
|
@ -51,6 +51,7 @@ class S3ObjList
|
||||
std::string GetETag(const char* name) const;
|
||||
bool IsDir(const char* name) const;
|
||||
bool GetNameList(s3obj_list_t& list, bool OnlyNormalized = true, bool CutSlash = true) const;
|
||||
bool GetLastName(std::string& lastname) const;
|
||||
|
||||
static bool MakeHierarchizedList(s3obj_list_t& list, bool haveSlash);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user