Skip to content

Commit 2755c70

Browse files
committed
fix(docs): satisfy current main quality gates
1 parent f7401bc commit 2755c70

2 files changed

Lines changed: 9 additions & 15 deletions

File tree

shortcuts/doc/html5_block_resources.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ type whiteboardStartTag struct {
6969
SelfClosing bool
7070
}
7171

72-
func buildCreateBodyWithHTML5ReferenceMap(runtime *common.RuntimeContext) (map[string]interface{}, error) {
73-
body, _, err := buildCreateBodyWithPreparedInput(runtime)
74-
return body, err
75-
}
76-
7772
func buildCreateBodyWithPreparedInput(runtime *common.RuntimeContext) (map[string]interface{}, []localDocResource, error) {
7873
body := buildCreateBody(runtime)
7974
if runtime.Str("content") == "" && !runtime.Changed("reference-map") {

shortcuts/doc/local_doc_resources.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)