Hallucinate a fix to -from

This commit is contained in:
2025-10-16 14:20:58 +02:00
parent eb81ec4162
commit 4e4e58af83

View File

@@ -270,17 +270,25 @@ func ParseYAMLFile(filename, workdir string) ([]LinkInstruction, error) {
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
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
var instructions []LinkInstruction
err = yaml.Unmarshal(data, &instructions)
if err != nil {
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{}