File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,18 @@ func DecodeNonStrings(m map[string]interface{}) error {
248248 case string :
249249 vInt , err := strconv .Atoi (val )
250250 if err != nil {
251- return fmt .Errorf ("shamir_threshold is not an integer: %s" , err .Error ())
251+ // Older versions of SOPS stored shamir_threshold as a floating point representation
252+ // of the actual integer. Try to parse a floating point number and see whether it
253+ // can be converted without loss to an integer.
254+ var vFloat float64
255+ vFloat , err = strconv .ParseFloat (val , 64 )
256+ if err != nil {
257+ return fmt .Errorf ("shamir_threshold is not an integer: %s" , err .Error ())
258+ }
259+ vInt = int (vFloat )
260+ if float64 (vInt ) != vFloat {
261+ return fmt .Errorf ("shamir_threshold is not an integer" )
262+ }
252263 }
253264 m ["shamir_threshold" ] = vInt
254265 case int :
You can’t perform that action at this time.
0 commit comments