diff --git a/NEWS.md b/NEWS.md index c61e96a5..41198dc7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,10 @@ # rsconnect (development version) * Restore the `LC_TIME` locale after computing an RFC-2616 date. (#1035) +* Address a problem inspecting Quarto content when the file names and paths + needed to be quoted. The resulting manifest lacked information about the + Quarto runtime, which caused difficult-to-understand deployment errors. + (#1037) # rsconnect 1.2.0 diff --git a/R/appMetadata-quarto.R b/R/appMetadata-quarto.R index 2b5290f0..5e682731 100644 --- a/R/appMetadata-quarto.R +++ b/R/appMetadata-quarto.R @@ -40,7 +40,7 @@ quartoInspect <- function(appDir = NULL, appPrimaryDoc = NULL) { paths <- c(appDir, file.path(appDir, appPrimaryDoc)) for (path in paths) { - args <- c("inspect", path.expand(path)) + args <- c("inspect", shQuote(path.expand(path))) inspect <- tryCatch( { json <- suppressWarnings(system2(quarto, args, stdout = TRUE, stderr = TRUE)) diff --git a/tests/testthat/test-appMetadata-quarto.R b/tests/testthat/test-appMetadata-quarto.R index 18fd922d..86ae50a3 100644 --- a/tests/testthat/test-appMetadata-quarto.R +++ b/tests/testthat/test-appMetadata-quarto.R @@ -94,6 +94,31 @@ test_that("quartoInspect identifies Quarto documents", { expect_true(all(c("quarto", "engines") %in% names(inspect))) }) +test_that("quartoInspect processes content within paths containing spaces", { + parent <- withr::local_tempdir() + dir <- file.path(parent, "space dir") + dir.create(dir) + writeLines(c( + "---", + "title: space path", + "---", + "this is a document within a path having spaces." + ), file.path(dir, "index.qmd")) + inspect <- quartoInspect(dir, "index.qmd") + expect_equal(inspect$engines, c("markdown")) +}) + +test_that("quartoInspect processes content with filenames containing spaces", { + dir <- local_temp_app(list("space file.qmd" = c( + "---", + "title: space name", + "---", + "this is a document with a filename having spaces." + ))) + inspect <- quartoInspect(dir, "space file.qmd") + expect_equal(inspect$engines, c("markdown")) +}) + test_that("quartoInspect returns NULL on non-quarto Quarto content", { skip_if_no_quarto()