modrinth / minotaur

Gradle plugin for deploying build artifacts to Modrinth.
GNU Lesser General Public License v2.1
81 stars 15 forks source link

Fix the README sync StackOverflow (hopefully permanently) #33

Closed Siphalor closed 1 year ago

Siphalor commented 1 year ago

As I was still experiencing the StackOverflow (#29), I decided to look into the actual cause and found this StackOverflow thread: https://stackoverflow.com/a/31691056. It explains that using (.|\n) or the like, is implemented recursively in the popular JVMs, which consequently causes this issue. The proposed solution is to use a single dot and set the pattern flag DOTALL which causes the dot to implicitly include new lines. Since the regex isn't using a recursive implementation for this, it should be safe from StackOverflows.

At least for my simple testing this holds true, so I decided to remove the try...catch block as well since it no longer seems necessary.