Commit 845bc84
committed
fix(quarto-core): handle Windows paths in !path metadata adjustment
adjust_paths_to_document_dir rebases !path metadata values (css,
resources, bibliography, ...) relative to the document directory. Two
Windows-only defects lived in that one function:
- The rebased value is stringified with to_string_lossy, so on Windows
pathdiff's native separators leaked into the value. Since it is used
verbatim in HTML hrefs (a css: !path <link>), the emitted attribute
became href="..\..\shared\styles.css" instead of forward slashes.
Normalize at the emission site with quarto_util::to_forward_slashes,
the same helper the SCSS and JSON-writer separator fixes reuse.
- The relative-path guard used Path::is_relative, which on Windows is
false only for drive-prefixed paths; a POSIX-absolute value like
/usr/share/base.css is not is_absolute there, so it was wrongly
rebased into ../../../usr/share/base.css. Guard on is_rooted
(has_root) instead, matching the helper's documented purpose.
The suite's dir-metadata-paths fixture and the existing
directory_metadata_tests (previously red on Windows, green elsewhere)
now pass on all platforms.1 parent 815248c commit 845bc84
1 file changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
240 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
241 | 247 | | |
242 | 248 | | |
243 | 249 | | |
| |||
0 commit comments