From 6d0a122816fabec6e7ef212c743fa22d7f38433e Mon Sep 17 00:00:00 2001 From: kristopher tate Date: Thu, 13 Sep 2018 23:34:01 +0900 Subject: [PATCH] src/cache_hash.cpp: support file paths that contain spaces; ref: #1510 --- src/cache_hash.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cache_hash.cpp b/src/cache_hash.cpp index b302946310..dcf15d16b9 100644 --- a/src/cache_hash.cpp +++ b/src/cache_hash.cpp @@ -337,6 +337,16 @@ Error cache_hit(CacheHash *ch, Buf *out_digest) { return ErrorInvalidFormat; } + // We should be at the last item, + // so switch from iterating on spaces ' ' to newlines '\n' + // First, check to make sure we have the runway to do so: + if (it.index == it.buffer.len) { + os_file_close(ch->manifest_file); + return ErrorInvalidFormat; + } + it.index++; + // Too close for missiles, I’m switching to guns + it.split_bytes = str("\n"); Optional> opt_file_path = SplitIterator_next(&it); if (!opt_file_path.is_some) { os_file_close(ch->manifest_file);