MCPcopy Create free account
hub / github.com/temporalio/temporal / Decode

Method Decode

chasm/path_encoder.go:92–132  ·  view source on GitHub ↗
(
	encodedPath string,
)

Source from the content-addressed store, hash-verified

90}
91
92func (e *defaultPathEncoder) Decode(
93 encodedPath string,
94) ([]string, error) {
95 if encodedPath == "" {
96 return rootPath, nil
97 }
98
99 path := make([]string, 0, 3)
100 var b strings.Builder
101 escaped := false
102 for _, r := range encodedPath {
103 if r == utf8.RuneError {
104 return nil, serviceerror.NewInvalidArgumentf("encodedPath contains invalid UTF-8 code point: %v", encodedPath)
105 }
106
107 if escaped {
108 _, _ = b.WriteRune(r)
109 escaped = false
110 continue
111 }
112
113 if r == '\\' {
114 escaped = true
115 continue
116 }
117
118 if r == '$' || r == '#' {
119 path = append(path, b.String())
120 b.Reset()
121 continue
122 }
123
124 _, _ = b.WriteRune(r)
125 }
126 if escaped {
127 return nil, serviceerror.NewInternalf("encoded path ends with escape character: %v", encodedPath)
128 }
129
130 path = append(path, b.String())
131 return path, nil
132}

Callers 1

Calls 2

StringMethod · 0.65
ResetMethod · 0.65

Tested by 1