diff --git a/ogc/features/domain/cursor.go b/ogc/features/domain/cursor.go index 4d7231b4..2f609b43 100644 --- a/ogc/features/domain/cursor.go +++ b/ogc/features/domain/cursor.go @@ -52,7 +52,7 @@ func encodeCursor(fid int64, filtersChecksum []byte) EncodedCursor { fidAsBytes := big.NewInt(fid).Bytes() // format of the cursor: - return EncodedCursor(base64.RawStdEncoding.EncodeToString(fidAsBytes) + string(separator) + base64.RawStdEncoding.EncodeToString(filtersChecksum)) + return EncodedCursor(base64.RawURLEncoding.EncodeToString(fidAsBytes) + string(separator) + base64.RawURLEncoding.EncodeToString(filtersChecksum)) } // Decode turns encoded cursor into DecodedCursor and verifies the @@ -69,8 +69,8 @@ func (c EncodedCursor) Decode(filtersChecksum []byte) DecodedCursor { log.Printf("cursor '%s' doesn't contain expected separator %c", value, separator) return DecodedCursor{filtersChecksum, 0} } - decodedFid, fidErr := base64.RawStdEncoding.DecodeString(encoded[0]) - decodedChecksum, checksumErr := base64.RawStdEncoding.DecodeString(encoded[1]) + decodedFid, fidErr := base64.RawURLEncoding.DecodeString(encoded[0]) + decodedChecksum, checksumErr := base64.RawURLEncoding.DecodeString(encoded[1]) if fidErr != nil || checksumErr != nil { log.Printf("decoding cursor value '%s' failed, defaulting to first page", value) return DecodedCursor{filtersChecksum, 0} diff --git a/ogc/features/domain/cursor_test.go b/ogc/features/domain/cursor_test.go index f8387d67..256a7639 100644 --- a/ogc/features/domain/cursor_test.go +++ b/ogc/features/domain/cursor_test.go @@ -173,7 +173,7 @@ func TestEncodedCursor_Pagination(t *testing.T) { }{ { name: "should not reset to first page", - c: "Z3Z8%7C%2BQ8mwg", + c: "Z3Z8%7C-Q8mwg", args: args{ filtersChecksum: []byte{249, 15, 38, 194}, },