Change QuicMemoryCacheBackend::InitializeDirectory() to handle cases where the
specified directory contains only files, not subdirectories naming
hosts.
gfe-relnote: n/a - tools only
https://bugs.chromium.org/p/chromium/issues/detail?id=1034470
PiperOrigin-RevId: 285875350
Change-Id: I352d71066f37d9a02280633ad439ad784c2531f2
diff --git a/quic/tools/quic_memory_cache_backend.cc b/quic/tools/quic_memory_cache_backend.cc
index ddf94fe..c7ac912 100644
--- a/quic/tools/quic_memory_cache_backend.cc
+++ b/quic/tools/quic_memory_cache_backend.cc
@@ -106,7 +106,12 @@
quiche::QuicheStringPiece base) {
DCHECK(base[0] != '/') << base;
size_t path_start = base.find_first_of('/');
- DCHECK(path_start != quiche::QuicheStringPiece::npos) << base;
+ if (path_start == quiche::QuicheStringPiece::npos) {
+ host_ = std::string(base);
+ path_ = "";
+ return;
+ }
+
host_ = std::string(base.substr(0, path_start));
size_t query_start = base.find_first_of(',');
if (query_start > 0) {