Skip to content

Commit

Permalink
Make multipart parsing more forgiving: start-of-line and casing
Browse files Browse the repository at this point in the history
I had a multipart response i wanted to parse, and julia failed to parse
it. These changes let it parse:
1. The content-disposition was the _second_ line in each part, with the
   content-type coming first, so the `^` was failing to parse.
2. The `content-type:` key was lower-cased, not Title-Cased as expected.

Dunno if these are generally correct, but they worked in my case.
  • Loading branch information
NHDaly committed Apr 5, 2024
1 parent 2de2c78 commit 9387824
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parsemultipart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ end

const content_disposition_regex = Parsers.RegexAndMatchData[]
function content_disposition_regex_f()
r = Parsers.RegexAndMatchData(r"^Content-Disposition:[ \t]*form-data;[ \t]*(.*)\r\n"x)
r = Parsers.RegexAndMatchData(r"^[Cc]ontent-[Dd]isposition:[ \t]*form-data;[ \t]*(.*)\r\n"mx)
Parsers.init!(r)
end

Expand Down

0 comments on commit 9387824

Please sign in to comment.