@@ -1104,7 +1104,7 @@ func emitLocalDocResourcePartialFailure(runtime *common.RuntimeContext, data map
11041104 item ["file_token" ] = outcome .FileToken
11051105 }
11061106 if outcome .Err != nil {
1107- item ["error" ] = sanitizedLocalDocResourceError (outcome .Err , outcome .Resource )
1107+ item ["error" ] = sanitizedLocalDocResourceError (runtime , outcome .Err , outcome .Resource )
11081108 }
11091109 items = append (items , item )
11101110 if outcome .Status == "bound" {
@@ -1127,19 +1127,18 @@ func emitLocalDocResourcePartialFailure(runtime *common.RuntimeContext, data map
11271127 return runtime .OutPartialFailure (data , nil )
11281128}
11291129
1130- func sanitizedLocalDocResourceError (err error , resource localDocResource ) map [string ]interface {} {
1130+ func sanitizedLocalDocResourceError (runtime * common. RuntimeContext , err error , resource localDocResource ) map [string ]interface {} {
11311131 message := err .Error ()
11321132 placeholder := fmt .Sprintf ("<local-%s-%d>" , resource .Kind , resource .Occurrence )
11331133 secrets := make ([]string , 0 , 12 )
1134- if resource .Path != "" {
1135- if absolutePath , absErr := filepath .Abs (resource .Path ); absErr == nil {
1136- secrets = append (secrets , absolutePath , filepath .ToSlash (absolutePath ))
1134+ if fileIO := runtime .FileIO (); fileIO != nil {
1135+ if resource .Path != "" {
1136+ if absolutePath , resolveErr := fileIO .ResolvePath (resource .Path ); resolveErr == nil {
1137+ secrets = append (secrets , absolutePath , filepath .ToSlash (absolutePath ))
1138+ }
11371139 }
1138- }
1139- if cwd , cwdErr := filepath .Abs ("." ); cwdErr == nil {
1140- secrets = append (secrets , cwd , filepath .ToSlash (cwd ))
1141- if realCWD , evalErr := filepath .EvalSymlinks (cwd ); evalErr == nil {
1142- secrets = append (secrets , realCWD , filepath .ToSlash (realCWD ))
1140+ if cwd , resolveErr := fileIO .ResolvePath ("." ); resolveErr == nil {
1141+ secrets = append (secrets , cwd , filepath .ToSlash (cwd ))
11431142 }
11441143 }
11451144 secrets = append (secrets , "@" + resource .Path , resource .Path , filepath .ToSlash (resource .Path ), resource .FileName , resource .Marker )
0 commit comments