Repository navigation
use project-relative path when previewing quarto documents - #18203
Merged
Merged
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clicking the Render button on a Quarto document living within a sub-directory of a Quarto project failed with:
RStudio launched the preview job as
quarto preview <filename>with the file's parent directory as the working directory. Newer versions of Quarto (reproduced with 1.9.38) fail to resolve a bare file name when previewing a file in a project sub-directory: the preview render step resolves the relative input against the project root rather than the process working directory. (Plainquarto render <filename>from the sub-directory works fine; the mis-resolution is specific toquarto preview.)The fix runs the preview job from the Quarto project root (already known via the captured project config file) and passes a project-relative path -- i.e.
quarto preview labs/doc.qmdfrom the project root, which is the same invocation that works from a terminal. Files not belonging to a Quarto project keep the previous behavior (file's parent directory as cwd), and a defensive fallback passes the absolute path if the target does not live under the computed working directory.Note that this leaves chunk-evaluation working-directory semantics untouched: Quarto governs the execution directory itself (
execute-dir), and RStudio's knit-directory preference does not flow into thequarto previewcode path.Testing
quarto preview doc.qmd --to html --no-watch-inputs --no-browserun from a website project sub-directory fails with the error above; the same preview invoked from the project root with a project-relative path succeeds.previewWorkingDir()/previewTargetPath()helpers (project sub-directory, project root, non-project file, whole-project directory target, and the absolute-path fallback).rstudio-tests --scope rsessionpasses (365 tests).Fixes #18197.