mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-18 02:05:13 +00:00
fix xpath selector in bucket listing
the original implementation in get_base_exp() depends on the order of xml return from the server. patriotically, when listing a directory with sub directory(s), the xml document response contains more than 2 <Prefix> nodes(some of them are in <CommonPrefixes> node). the source code arbitrarily select the first one in the documents (nodes->nodeTab[0]->xmlChildrenNode). some s3 compatible service return the list-bucket result in different result, leading the s3fs to a wrong behavior
This commit is contained in:
parent
1a23b880d5
commit
04493de767
@ -2724,7 +2724,7 @@ static xmlChar* get_base_exp(xmlDocPtr doc, const char* exp)
|
||||
{
|
||||
xmlXPathObjectPtr marker_xp;
|
||||
string xmlnsurl;
|
||||
string exp_string = "//";
|
||||
string exp_string;
|
||||
|
||||
if(!doc){
|
||||
return NULL;
|
||||
@ -2733,8 +2733,11 @@ static xmlChar* get_base_exp(xmlDocPtr doc, const char* exp)
|
||||
|
||||
if(!noxmlns && GetXmlNsUrl(doc, xmlnsurl)){
|
||||
xmlXPathRegisterNs(ctx, (xmlChar*)"s3", (xmlChar*)xmlnsurl.c_str());
|
||||
exp_string += "s3:";
|
||||
exp_string = "/s3:ListBucketResult/s3:";
|
||||
} else {
|
||||
exp_string = "/ListBucketResult/";
|
||||
}
|
||||
|
||||
exp_string += exp;
|
||||
|
||||
if(NULL == (marker_xp = xmlXPathEvalExpression((xmlChar *)exp_string.c_str(), ctx))){
|
||||
|
Loading…
Reference in New Issue
Block a user