Closed andreas closed 5 years ago
(* Old implementation *) Str.(split (regexp "/") "/graphql" - : ["graphql"] : string list (* New implementation *) Astring.String.cuts ~sep:"/" "/graphql" - : [""; "graphql"] Astring.String.cuts ~sep:"/" "/graphql/" - : [""; "graphql"; ""]
By adding ~empty:false, the old behavior can be restored:
~empty:false
Astring.String.cuts ~empty:false ~sep:"/" "/graphql" - : ["graphql"] Astring.String.cuts ~empty:false ~sep:"/" "/graphql/" - : ["graphql"]
This is preferable over changing the pattern matching (#149) due to handling of the trailing slashes.
@andreas and @anmonteiro thanks! I was smashing my head against this for so long before I reached out. Glad this is getting a fix 😄
@phated Sorry about that 😢
146 inadvertently introduced a bug due to the different handling of empty parts when splitting strings:
By adding
~empty:false
, the old behavior can be restored:This is preferable over changing the pattern matching (#149) due to handling of the trailing slashes.