mafintosh / gunzip-maybe

Transform stream that gunzips its input if it is gzipped and just echoes it if not
MIT License
106 stars 16 forks source link

Fix maxRecursion functionality #8

Closed sth closed 4 years ago

sth commented 6 years ago

The maxRecursion parameter is reduced by one in each recursive call. The intention is to raise an exception when it drops below zero. This currently doesn't work because maxRecursion is reset to 3 whenever it is below zero.

This pull request fixes the problem by only setting maxRecursion = 3 when the parameter was undefined. It also adds a test to ensure that maxRecursion actually works now.

mafintosh commented 4 years ago

Thanks! Out in 1.4.2