Skip to content

Commit

Permalink
Minor syntax adjustments to the S3 truncated/nextmarker dirlisting im…
Browse files Browse the repository at this point in the history
…plementation
  • Loading branch information
mpatrascoiu committed Jun 24, 2024
1 parent 38faaea commit 44ac612
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
11 changes: 6 additions & 5 deletions src/fileops/davmeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,12 +1120,13 @@ void s3_start_listing_query(std::unique_ptr<DirHandle> & handle, Context & conte


bool s3_directory_listing(std::unique_ptr<DirHandle> & handle, Context & context, const RequestParams* params, const Uri & uri, const std::string & body, std::string & name_entry, StatInfo & info){
if(handle.get() == NULL){
s3_start_listing_query(handle, context, params, uri, body);
}
XMLPropParser& parser = *(handle->parser);
if (parser.getProperties().size() == 0 && parser.getNextMarker() != "") {
if (handle.get() == NULL){
s3_start_listing_query(handle, context, params, uri, body);
} else {
XMLPropParser& parser = *(handle->parser);
if (parser.getProperties().empty() && !parser.getNextMarker().empty()) {
s3_start_listing_query(handle, context, params, uri, body);
}
}
return s3_get_next_property(handle, name_entry, info);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xml/davxmlparser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ElementsParser {
virtual ~ElementsParser(){}

virtual std::deque<FileProperties> & getProperties()=0;
virtual std::string getNextMarker() { return "";};
virtual std::string getNextMarker() { return ""; };

};

Expand Down
9 changes: 2 additions & 7 deletions src/xml/s3propparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,7 @@ struct S3PropParser::Internal{

// IsTruncated
if( (_s3_listing_mode == S3ListingMode::Hierarchical) && (StrUtil::compare_ncase(istruncated_prop, elem) ==0)){
if (current == "True" || current == "true") {
istruncated = true;
}
else {
istruncated = false;
}
istruncated = (current == "True" || current == "true");
}

// NextMarker
Expand Down Expand Up @@ -276,7 +271,7 @@ std::deque<FileProperties> & S3PropParser::getProperties(){
}

std::string S3PropParser::getNextMarker() {
return (d_ptr->istruncated? d_ptr->nextmarker : "");
return (d_ptr->istruncated ? d_ptr->nextmarker : "");
}


Expand Down

0 comments on commit 44ac612

Please sign in to comment.