puppetlabs / ruby-pwsh

A ruby gem for interacting with PowerShell
MIT License
15 stars 24 forks source link

(CAT-2061) Fix empty string nullification #346

Closed david22swan closed 2 months ago

david22swan commented 2 months ago

Reinstating reverted change by Clebam with additional fix suggested by original author.

Original PR: https://github.com/puppetlabs/ruby-pwsh/pull/292 Revert PR: https://github.com/puppetlabs/ruby-pwsh/pull/342 Reason for revert: https://github.com/puppetlabs/ruby-pwsh/issues/340 Original author: https://github.com/Clebam

Checklist

david22swan commented 2 months ago

@Clebam Could you confirm that this is what you had in mind for your suggested fix on the revert PR?

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.08%. Comparing base (78c3f26) to head (ccd3b58). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #346 +/- ## ======================================= Coverage 92.08% 92.08% ======================================= Files 6 6 Lines 720 720 ======================================= Hits 663 663 Misses 57 57 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Clebam commented 2 months ago

Hi @david22swan, Yes indeed. The purpose of this piece of code is to avoid sending a nil to a value that accepts only an Enum containing an empty string ''.

Originally my regex was a bit to wide an included Array[Enum[... (leading to the issue that lead to the revert)

The fix should properly only aim at Enum[