Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quote paths when running 'quarto inspect' #1038

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
29 changes: 29 additions & 0 deletions tests/testthat/test-appMetadata-quarto.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,35 @@ test_that("quartoInspect identifies Quarto documents", {
expect_true(all(c("quarto", "engines") %in% names(inspect)))
})

test_that("quartoInspect processes content within paths containing spaces", {
skip_if_no_quarto()

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", {
skip_if_no_quarto()

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
Loading