diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 97895ec4e1..09b05c3525 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -2040,7 +2040,7 @@ sstring sstable::component_basename(const sstring& ks, const sstring& cf, versio format_types format, sstring component) { sstring v = fmt::to_string(version); sstring g = to_sstring(generation); - sstring f = format_string.at(format); + sstring f = fmt::to_string(format); switch (version) { case sstable::version_types::ka: return ks + "-" + cf + "-" + v + "-" + g + "-" + component; diff --git a/sstables/version.hh b/sstables/version.hh index 7d8d7c6bf1..0f0fe4a09a 100644 --- a/sstables/version.hh +++ b/sstables/version.hh @@ -96,3 +96,11 @@ struct fmt::formatter : fmt::formatter +struct fmt::formatter : fmt::formatter { + template + auto format(const sstables::sstable_format_types& format, FormatContext& ctx) const { + return fmt::format_to(ctx.out(), "{}", sstables::format_string.at(format)); + } +};