mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 05:43:09 -06:00
s/|/./g so tokens url escape nicely
This commit is contained in:
parent
e9ef552ca0
commit
acda5d7b58
|
|
@ -132,8 +132,8 @@ func (t *StreamingToken) String() string {
|
|||
logStr := fmt.Sprintf("%s-%d-%d", name, lp.Partition, lp.Offset)
|
||||
logStrings = append(logStrings, logStr)
|
||||
}
|
||||
// E.g s11_22_33|dl0-134|ab1-441
|
||||
return strings.Join(logStrings, "|")
|
||||
// E.g s11_22_33.dl0-134.ab1-441
|
||||
return strings.Join(logStrings, ".")
|
||||
}
|
||||
|
||||
// IsAfter returns true if ANY position in this token is greater than `other`.
|
||||
|
|
@ -236,7 +236,7 @@ func newSyncTokenFromString(s string) (token *syncToken, categories []string, er
|
|||
switch t := SyncTokenType(s[:1]); t {
|
||||
case SyncTokenTypeStream, SyncTokenTypeTopology:
|
||||
token.Type = t
|
||||
categories = strings.Split(s[1:], "|")
|
||||
categories = strings.Split(s[1:], ".")
|
||||
positions = strings.Split(categories[0], "_")
|
||||
default:
|
||||
return nil, nil, ErrInvalidSyncTokenType
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ func TestNewSyncTokenWithLogs(t *testing.T) {
|
|||
syncToken: syncToken{Type: "s", Positions: []StreamPosition{4, 0}},
|
||||
logs: make(map[string]*LogPosition),
|
||||
},
|
||||
"s4_0|dl-0-123": &StreamingToken{
|
||||
"s4_0.dl-0-123": &StreamingToken{
|
||||
syncToken: syncToken{Type: "s", Positions: []StreamPosition{4, 0}},
|
||||
logs: map[string]*LogPosition{
|
||||
"dl": &LogPosition{
|
||||
|
|
@ -20,7 +20,7 @@ func TestNewSyncTokenWithLogs(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
"s4_0|dl-0-123|ab-1-14419482332": &StreamingToken{
|
||||
"s4_0.dl-0-123.ab-1-14419482332": &StreamingToken{
|
||||
syncToken: syncToken{Type: "s", Positions: []StreamPosition{4, 0}},
|
||||
logs: map[string]*LogPosition{
|
||||
"ab": &LogPosition{
|
||||
|
|
|
|||
Loading…
Reference in a new issue