Skip to content

Base64 string padding char seems to trip up parser #31

@alexswan10k

Description

@alexswan10k

Description

For base 64 encoded strings, they are often padded with an = character. This seems to break the parser and return None for a query string parameter with padding.

Workaround
String.replace ("=", "@") //or some other character that isn't in the standard base64 set and is allowed in a query param
//https://en.wikipedia.org/wiki/Base64

Repro code

let route = s "someRoute"  <?> stringParam "data"

Then run any query string with padding. For example:
domain.com/someRoute?data=YQ==
where data is "a" in this context.

Expected and actual results

  • Expected
    ** data = Some "YQ=="
  • Actual
    ** data = None

Related information

  • elmish version: Fable.Elmish (3.0.6)
  • fable-compiler version: 2.4.11
  • fable-core version:Fable.Core (3.1.3)
  • Operating system: Windows 10

Hopefully this is quite clear. I imagine it is probably due to the parser maybe splits on = rather than parse based on previous context - eg a parameter can only start with ? or & and is followed by an =.

I know that base64 isnt that common, but its handy for passing around complex serialised graphs compactly. Tokens are also also sometimes sent back to a client this way, although they do use hashtag navigation.

Let me know if anything else is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions