@@ -79,26 +79,25 @@ func refactorApplicationCrypto(ctx context.Context, db *gorp.DbMap, id int64) er
79
79
return sdk .WrapError (err , "unable to select and lock application %d" , id )
80
80
}
81
81
82
- if len (btes ) == 0 {
83
- return nil
84
- }
85
-
86
82
var vcsStrategy sdk.RepositoryStrategy
87
- if err := json .Unmarshal (btes , & vcsStrategy ); err != nil {
88
- return sdk .WrapError (err , "unable to unmarshal application RepositoryStrategy %d" , id )
89
- }
83
+ var clearPWD []byte
84
+ if len (btes ) != 0 {
85
+ if err := json .Unmarshal (btes , & vcsStrategy ); err != nil {
86
+ return sdk .WrapError (err , "unable to unmarshal application RepositoryStrategy %d" , id )
87
+ }
90
88
91
- encryptedPassword , err64 := base64 .StdEncoding .DecodeString (vcsStrategy .Password )
92
- if err64 != nil {
93
- return sdk .WrapError (err64 , "unable to decode password for application %d" , id )
94
- }
89
+ encryptedPassword , err := base64 .StdEncoding .DecodeString (vcsStrategy .Password )
90
+ if err != nil {
91
+ return sdk .WrapError (err , "unable to decode password for application %d" , id )
92
+ }
95
93
96
- clearPWD , err : = secret .Decrypt ([]byte (encryptedPassword ))
97
- if err != nil {
98
- return sdk .WrapError (err , "Unable to decrypt password for application %d" , id )
99
- }
94
+ clearPWD , err = secret .Decrypt ([]byte (encryptedPassword ))
95
+ if err != nil {
96
+ return sdk .WrapError (err , "Unable to decrypt password for application %d" , id )
97
+ }
100
98
101
- vcsStrategy .Password = string (clearPWD )
99
+ vcsStrategy .Password = string (clearPWD )
100
+ }
102
101
103
102
var tmpApp = sdk.Application {
104
103
ID : id ,
0 commit comments