Closed dbradleyfl closed 2 years ago
So this whole issue arose around a very frustrating combination of regex requirements...
my.file
)my.file.jpg
)Turns out, it's really difficult to do both, especially in an efficient/code-golfed regex manner (kinda key to itty being... you know... "itty"). Since both were relatively undocumented paths, I opted short term to at least not break with periods in the filenames, under the assumption that if you're going down the format path, that you could just declare it non-optionally. It's not ideal, and this will be fixed as soon as we/I solve the regex.
From the test suite:
The regex is a royal pain, because it's really regex that writes regex, that is LATER parsed in the request.handle
. If anyone wants to take a crack at solving it (especially without adding a bunch of characters), I'd name someone else's firstborn after the winner! Here's the entire regex for itty:
This is being fixed in an upcoming PR... lost some bytes in the process, but I'll see if I can regain them later!
Example code on replit: https://replit.com/@dbradleyfl/itty-optional-format-parsing#index.js