From c63e42717cd6be2e112fcaa8bcdacc21498e6e05 Mon Sep 17 00:00:00 2001 From: Mengjing Xu Date: Fri, 9 May 2025 19:42:40 -0700 Subject: [PATCH] Fix S3 GetChildren() substr index error --- tensorflow_io/core/filesystems/s3/s3_filesystem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_io/core/filesystems/s3/s3_filesystem.cc b/tensorflow_io/core/filesystems/s3/s3_filesystem.cc index 654269536..fb1135adf 100644 --- a/tensorflow_io/core/filesystems/s3/s3_filesystem.cc +++ b/tensorflow_io/core/filesystems/s3/s3_filesystem.cc @@ -1185,9 +1185,9 @@ int GetChildren(const TF_Filesystem* filesystem, const char* path, list_objects_result = list_objects_outcome.GetResult(); for (const auto& object : list_objects_result.GetCommonPrefixes()) { Aws::String s = object.GetPrefix(); - s.erase(s.length() - 1); Aws::String entry = s.substr(prefix.length()); if (entry.length() > 0) { + entry.erase(entry.length() - 1); result.push_back(entry); } }