File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -2354,3 +2354,34 @@ func TestInvalidProjectNameType(t *testing.T) {
23542354 assert .Error (t , err , "validating filename0.yml: name must be a string" )
23552355 assert .Assert (t , is .Nil (p ))
23562356}
2357+
2358+ func TestNumericIDs (t * testing.T ) {
2359+ p , err := loadYAML (`
2360+ name: 'test-numeric-ids'
2361+ services:
2362+ foo:
2363+ image: busybox
2364+ volumes:
2365+ - 0:/foo
2366+
2367+ volumes:
2368+ '0': {}
2369+ ` )
2370+ assert .NilError (t , err )
2371+ assert .DeepEqual (t , p .Services , types.Services {
2372+ {
2373+ Name : "foo" ,
2374+ Image : "busybox" ,
2375+ Environment : types.MappingWithEquals {},
2376+ Scale : 1 ,
2377+ Volumes : []types.ServiceVolumeConfig {
2378+ {
2379+ Type : types .VolumeTypeVolume ,
2380+ Source : "0" ,
2381+ Target : "/foo" ,
2382+ Volume : & types.ServiceVolumeVolume {},
2383+ },
2384+ },
2385+ },
2386+ })
2387+ }
Original file line number Diff line number Diff line change @@ -176,5 +176,8 @@ func isFilePath(source string) bool {
176176 }
177177
178178 first , nextIndex := utf8 .DecodeRuneInString (source )
179+ if len (source ) <= nextIndex {
180+ return false
181+ }
179182 return isWindowsDrive ([]rune {first }, rune (source [nextIndex ]))
180183}
You can’t perform that action at this time.
0 commit comments