Skip to content

Commit

Permalink
quote paths when running 'quarto inspect'
Browse files Browse the repository at this point in the history
fixes #1037
  • Loading branch information
aronatkins committed Jan 25, 2024
1 parent 6115797 commit 72a46b7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion R/appMetadata-quarto.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
25 changes: 25 additions & 0 deletions tests/testthat/test-appMetadata-quarto.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 72a46b7

Please sign in to comment.