Fix #1348, go back to converting plus "+" to space
Not doing this conflicts with some http clients and proxies. Use the alternative url-safe character '!' instead for disambiguating resource embedding.
This commit is contained in:
committed by
Steve Chávez
parent
e83144ce7f
commit
ae9e27a0c7
@@ -138,14 +138,14 @@ userApiRequest schema rootSpec req reqBody
|
||||
, iCanonicalQS = toS $ urlEncodeVars
|
||||
. L.sortOn fst
|
||||
. map (join (***) toS . second (fromMaybe BS.empty))
|
||||
$ queryStringWPlus
|
||||
$ qString
|
||||
, iJWT = tokenStr
|
||||
, iHeaders = [ (toS $ CI.foldedCase k, toS v) | (k,v) <- hdrs, k /= hAuthorization, k /= hCookie]
|
||||
, iCookies = maybe [] parseCookiesText $ lookupHeader "Cookie"
|
||||
}
|
||||
where
|
||||
-- queryString with '+' not converted to ' '
|
||||
queryStringWPlus = parseQueryReplacePlus False $ rawQueryString req
|
||||
-- queryString with '+' converted to ' '(space)
|
||||
qString = parseQueryReplacePlus True $ rawQueryString req
|
||||
-- rpcQParams = Rpc query params e.g. /rpc/name?param1=val1, similar to filter but with no operator(eq, lt..)
|
||||
(filters, rpcQParams) =
|
||||
case action of
|
||||
@@ -215,7 +215,7 @@ userApiRequest schema rootSpec req reqBody
|
||||
path = pathInfo req
|
||||
method = requestMethod req
|
||||
hdrs = requestHeaders req
|
||||
qParams = [(toS k, v)|(k,v) <- queryStringWPlus]
|
||||
qParams = [(toS k, v)|(k,v) <- qString]
|
||||
lookupHeader = flip lookup hdrs
|
||||
hasPrefer :: Text -> Bool
|
||||
hasPrefer val = any (\(h,v) -> h == "Prefer" && val `elem` split v) hdrs
|
||||
|
||||
@@ -131,7 +131,7 @@ pRelationSelect = lexeme $ try ( do
|
||||
alias <- optionMaybe ( try(pFieldName <* aliasSeparator) )
|
||||
fld <- pField
|
||||
relationDetail <- optionMaybe (
|
||||
try ( char '+' *> pFieldName ) <|>
|
||||
try ( char '!' *> pFieldName ) <|>
|
||||
try ( char '.' *> pFieldName ) -- TODO deprecated, remove in next major version
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user