```markdown
---
title: Test including figure in docx
format: html
keep-md: true
---

![This is an elephant.](elephant.png){#fig-elephant width=650}

```

(`elephant.png` is from our website, but any image will cause issue)

`quarto render` on this doc, and process is stuck at 
````powershell
> quarto render test2.qmd
Quarto version: 99.9.9
Loaded deno-dom-native
Windows: Using code page 1252
pandoc --verbose --trace
  to: html
  output-file: test2.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png

metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: Test including figure in docx

[INFO] Loaded C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\template.patched from C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\template.patched
[INFO] Loaded C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\metadata.html from C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\metadata.html
[INFO] Loaded C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\styles.html from C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\styles.html
[INFO] Loaded C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\title-block.html from C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\title-block.html
[INFO] Loaded C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\title-metadata.html from C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\title-metadata.html
[INFO] Loaded C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\title-block.html from C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\title-block.html
[INFO] Loaded C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\title-metadata.html from C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\title-metadata.html
[INFO] Loaded C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\toc.html from C:\Users\chris\AppData\Local\Temp\quarto-session378b8c77\17dd0693\0dc0abb2\toc.html
[trace] Parsed [Plain [Str "long"]] at line 1
[trace] Parsed [Plain [Str "en"]] at line 1
[trace] Parsed [Plain [Str "true"]] at line 1
[trace] Parsed [Plain [Str "99.9.9"]] at line 1
[trace] Parsed [Plain [Str "Test",Space,Str "including",Space,Str "figure", at line 1
[trace] Parsed [Plain [Str "Table",Space,Str "of",Space,Str "contents"]] at line 1
[trace] Parsed [] at line 5
[trace] Parsed [Figure ("fig-elephant",[],[]) (Caption Nothing [Plain [Str  at line 8
[INFO] Running filter C:/Users/chris/Documents/DEV_R/quarto-cli/src/resources/filters/main.lua
[INFO] Completed filter C:/Users/chris/Documents/DEV_R/quarto-cli/src/resources/filters/main.lua in 46 ms
^CTerminer le programme de commandes (O/N) ? O
````

Took me sometime to find as I tried a few things. 

* Trying to use the tracing feature gave me the hint of infinite loop as the trace created is more than  2 Gb (!!) 

* I ended up running a git bisect to find where it happens, to understand why. 

Culprit is https://github.com/quarto-dev/quarto-cli/commit/553fec5f3c421a8c0e9a533ef47d76c6f002e437#diff-a86a3d2ddd41304881ed9f8418b10f3e960315213da5cf51b76a687c88ef1e50R53 (👋 @dragonstyle ) 

Running a debug mode in VSCODE showed me the difference 

in here
https://github.com/quarto-dev/quarto-cli/blob/1f3581304d2d1112ae22cd970e7c176d8be15600/src/core/path.ts#L275-L276

we were looking for `expandGlobs("elephant.png")` but after the commit, we are looking for `expandGlobs("**\elephant.png")`

The difference is small in the commit but the strict mode was removed 
https://github.com/quarto-dev/quarto-cli/blob/9402ca9ad15b8c693fcc2c7691df3becb3d3631e/src/command/render/resources.ts#L54-L56

So this mode was setting smartGlob to FALSE
https://github.com/quarto-dev/quarto-cli/blob/1f3581304d2d1112ae22cd970e7c176d8be15600/src/core/path.ts#L209-L226

but now, it is set to TRUE and we end up going into any `if(smartGlob)` 

Hope it makes it clear. I can detail more and show what happens. 

@dragonstyle any insight why remove the strict mode and then change the smartGlob value ? 


It does not explain the infinite loop but it is related to 
```
expandGlobs("**\elephant.png")
```
on Windows 





dragonstyle
2023-06-15T16:19:39Z
cderv
bug
open
Rendering is stuck on Windows for a simple doc 
https://github.com/quarto-dev/quarto-cli/issues/5942