From d7eb57f5a99ad36ee79f5c716a6f936c97bd6267 Mon Sep 17 00:00:00 2001 From: TroyHernandez Date: Tue, 19 May 2026 01:39:18 -0500 Subject: [PATCH] Pre-empt latent Windows path-mismatch in update_index() R/index.R:28-29 uses the same `dirname(file) != vault` filter that vault_graph() did. On Windows normalizePath() returns backslashes while dirname() returns forward slashes, so the comparison is always false and control files leak into the post-filter all_md. This is currently inert because update_index()'s downstream emission loop iterates over `categories` and only outputs files whose path starts with one of wiki/, raw/articles/, raw/chats/, ..., so control files at the vault root never appear in index.md. test_index.R's "no [[index]] / [[log]] / [[schema]]" assertions pass for the same reason. If anyone later refactors the category-prefix filter the bug becomes live. Normalise `vault` with winslash = "/" to match dirname()'s output on both platforms. Same fix shape as vault_graph() in 0.6.3. No version bump: 0.6.3 isn't on CRAN yet; this rides under the same submission. --- R/index.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/index.R b/R/index.R index dc4a701..fb67b82 100644 --- a/R/index.R +++ b/R/index.R @@ -16,7 +16,12 @@ #' unlink(v, recursive = TRUE) #' @export update_index <- function(vault = default_vault()) { - vault <- normalizePath(vault, mustWork = TRUE) + # winslash = "/" so this matches dirname()'s forward-slash output + # on Windows (where normalizePath() defaults to backslashes). + # Same fix as vault_graph(); the bug here is currently neutralised + # by the category-prefix filter below, but the buggy pattern is a + # latent footgun if that downstream filter is ever refactored. + vault <- normalizePath(vault, mustWork = TRUE, winslash = "/") if (vault_is_adopted(vault)) { return(update_index_adopted(vault))