File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -721,6 +721,13 @@ GCSFileSystem::GetDirectoryContents(
721
721
// Let set take care of subdirectory contents
722
722
std::string item = name.substr (item_start, item_end - item_start);
723
723
contents->insert (item);
724
+
725
+ // Fail-safe check to ensure the item name is not empty
726
+ if (item.empty ()) {
727
+ return Status (
728
+ Status::Code::INTERNAL,
729
+ " Cannot handle item with empty name at " + path);
730
+ }
724
731
}
725
732
return Status::Success;
726
733
}
@@ -1135,6 +1142,12 @@ ASFileSystem::GetDirectoryContents(
1135
1142
auto func = [&](const as::list_blobs_segmented_item& item,
1136
1143
const std::string& dir) {
1137
1144
contents->insert (dir);
1145
+ // Fail-safe check to ensure the item name is not empty
1146
+ if (dir.empty ()) {
1147
+ return Status (
1148
+ Status::Code::INTERNAL,
1149
+ " Cannot handle item with empty name at " + path);
1150
+ }
1138
1151
return Status::Success;
1139
1152
};
1140
1153
std::string container, dir_path;
@@ -1777,6 +1790,13 @@ S3FileSystem::GetDirectoryContents(
1777
1790
// Let set take care of subdirectory contents
1778
1791
std::string item = name.substr (item_start, item_end - item_start);
1779
1792
contents->insert (item);
1793
+
1794
+ // Fail-safe check to ensure the item name is not empty
1795
+ if (item.empty ()) {
1796
+ return Status (
1797
+ Status::Code::INTERNAL,
1798
+ " Cannot handle item with empty name at " + true_path);
1799
+ }
1780
1800
}
1781
1801
} else {
1782
1802
return Status (
You can’t perform that action at this time.
0 commit comments