@@ -121,12 +121,6 @@ func Parse(r io.Reader) (envMap map[string]string, err error) {
121
121
return
122
122
}
123
123
124
- // Previous multi-line value was not closed. We shouldn't find new keys until closing the multi-line value
125
- if isMultilineValue && len (multilineKey ) > 0 && len (key ) > 0 {
126
- err = fmt .Errorf ("Multiline value for key %s reached key %s without closing the single quotes" , multilineKey , key )
127
- return
128
- }
129
-
130
124
if multilineValue == true && isMultilineValue == false && len (key ) <= 0 {
131
125
// We are on a multi-line; but last line closed the multi-line single quote
132
126
value = fmt .Sprintf ("%s\n %s" , buffer , value )
@@ -282,44 +276,44 @@ func parseLine(line string, envMap map[string]string, isMultiline bool) (key str
282
276
multilineValue = quotesAreOpen
283
277
}
284
278
285
- firstEquals := strings .Index (line , "=" )
286
- firstColon := strings .Index (line , ":" )
287
- splitString := strings .SplitN (line , "=" , 2 )
288
- if firstColon != - 1 && (firstColon < firstEquals || firstEquals == - 1 ) {
289
- //this is a yaml-style line
290
- splitString = strings .SplitN (line , ":" , 2 )
291
- }
279
+ if ! isMultiline {
280
+ firstEquals := strings .Index (line , "=" )
281
+ firstColon := strings .Index (line , ":" )
282
+ splitString := strings .SplitN (line , "=" , 2 )
283
+ if firstColon != - 1 && (firstColon < firstEquals || firstEquals == - 1 ) {
284
+ //this is a yaml-style line
285
+ splitString = strings .SplitN (line , ":" , 2 )
286
+ }
292
287
293
- // Only check key, value pair if is not a multi-line value
294
- if isMultiline == false && len (splitString ) != 2 {
295
- err = errors .New ("Can't separate key from value" )
296
- return
297
- }
288
+ // Only check key, value pair if is not a multi-line value
289
+ if isMultiline == false && len (splitString ) != 2 {
290
+ err = errors .New ("Can't separate key from value" )
291
+ return
292
+ }
298
293
299
- if len (splitString ) == 2 {
300
- // Parse the key
301
- key = splitString [0 ]
302
- if strings .HasPrefix (key , "export" ) {
303
- key = strings .TrimPrefix (key , "export" )
294
+ if len (splitString ) == 2 {
295
+ // Parse the key
296
+ key = splitString [0 ]
297
+ if strings .HasPrefix (key , "export" ) {
298
+ key = strings .TrimPrefix (key , "export" )
299
+ }
300
+ key = strings .Trim (key , " " )
304
301
}
305
- key = strings .Trim (key , " " )
306
- }
307
302
308
- if ! isMultiline {
309
303
// Parse the value
310
304
value = parseValue (splitString [1 ], envMap )
311
305
if len (value ) <= 0 {
312
306
return
313
307
}
314
308
315
- // Multi-line delimiting character is a single quote '
316
- if multilineValue = (value [0 :1 ] == "'" && value [len (value )- 1 :] != "' " ); multilineValue == true {
309
+ // Multi-line delimiting character is a double quote "
310
+ if multilineValue = (value [0 :1 ] == "\" " && value [len (value )- 1 :] != "\" " ); multilineValue == true {
317
311
value = value [1 :len (value )]
318
312
}
319
313
} else {
320
- value = parseValue (splitString [ 0 ] , envMap )
314
+ value = parseValue (line , envMap )
321
315
// Check if we reached the end of the multi-line value
322
- multilineValue = value [len (value )- 1 :] != "' "
316
+ multilineValue = value [len (value )- 1 :] != "\" "
323
317
}
324
318
325
319
return
0 commit comments