Hallucinate a fix to -from
This commit is contained in:
@@ -270,17 +270,25 @@ func ParseYAMLFile(filename, workdir string) ([]LinkInstruction, error) {
|
|||||||
return nil, fmt.Errorf("error reading YAML file: %w", err)
|
return nil, fmt.Errorf("error reading YAML file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// First try to parse as a list of link instructions
|
// First try to parse as a YAMLConfig with links and from fields
|
||||||
var config YAMLConfig
|
var config YAMLConfig
|
||||||
err = yaml.Unmarshal(data, &config)
|
err = yaml.Unmarshal(data, &config)
|
||||||
if err != nil || len(config.Links) == 0 {
|
LogInfo("First parsing attempt: err=%v, links=%d, from=%d", err, len(config.Links), len(config.From))
|
||||||
|
if err != nil {
|
||||||
// If that fails, try parsing as a direct list of instructions
|
// If that fails, try parsing as a direct list of instructions
|
||||||
var instructions []LinkInstruction
|
var instructions []LinkInstruction
|
||||||
err = yaml.Unmarshal(data, &instructions)
|
err = yaml.Unmarshal(data, &instructions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error parsing YAML: %w", err)
|
return nil, fmt.Errorf("error parsing YAML: %w", err)
|
||||||
}
|
}
|
||||||
config.Links = instructions
|
// Filter out invalid instructions (empty source)
|
||||||
|
validInstructions := []LinkInstruction{}
|
||||||
|
for _, instr := range instructions {
|
||||||
|
if instr.Source != "" {
|
||||||
|
validInstructions = append(validInstructions, instr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config.Links = validInstructions
|
||||||
}
|
}
|
||||||
|
|
||||||
expanded := []LinkInstruction{}
|
expanded := []LinkInstruction{}
|
||||||
|
Reference in New Issue
Block a user