ori-repro-earlier-bug/README.md

36 lines
1.7 KiB
Markdown

* `addFilenameData.js` called twice at startup (it logs the key)
* called again when `allfiles/ad_hello_pub.md` requested, but now the key has a trailing slash.
* note: again, it's called twice, but the **first** time the key doesn't have a slash, and the **second** time, it does, which causes
* this looks like a server redirect causing issues ...
* but when I use the cli the key gets logged _three_ times: `ori pipeline.ori()/allfiles/ad_hello_pub.md`
* the parser (PeggyJS grammmar) doesn't expect a trailing slash and errors.
* when `renderedPages/hello.html` is requested, the parser sees the filename _without_ trailing slash, and runs successfully.
It also seems like addFilenameData.js is being called for every entry in the original map: all three markdown files in the directory. huh?
It seems like the key which the server requests is propagating up the pipeline. Huh?
server log:
```
$ ori "serve watch ., =debug ./pipeline.ori()"
key: ad_hello_pub.md
key: ad_hello_pub.md
Server running at http://localhost:5000. Press Ctrl+C to stop.
/renderedPages/hello.html
key: ad_hello_pub.md
/allfiles/ad_hello_pub.md
key: ad_hello_pub.md
/allfiles/ad_hello_pub.md/
key: ad_hello_pub.md/
SyntaxError: Expected ".", [a-z0-9], or end of input but "/" found.
at peg$buildStructuredError (file:///home/hans/exp/ori-repro-earlier-bug/filenameparser.js:356:12)
at peg$throw (file:///home/hans/exp/ori-repro-earlier-bug/filenameparser.js:694:11)
at peg$parse (file:///home/hans/exp/ori-repro-earlier-bug/filenameparser.js:716:5)
at OrigamiFileMap.default (file:///home/hans/exp/ori-repro-earlier-bug/addFilenameData.js?cacheBust=1773838110056:5:15)
evaluating: addFilenameData.js(value, key)
at pipeline.ori:14:58
```