Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Nov 24, 2023
1 parent 2ae0baa commit 4583c57
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/http/formdata.cr
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,11 @@ module HTTP::FormData
size = nil
name = nil

first = true
content_disposition.split(';') do |part|
if first
first = false
raise Error.new("Invalid Content-Disposition: not form-data") unless part == "form-data"
next
end

key, _, value = part.partition('=')
parts = content_disposition.split(';')
type = parts.shift?
raise Error.new("Invalid Content-Disposition: not form-data") unless type == "form-data"
parts.each do |part|
key, value = part.split('=', 2)
key = key.strip
value = value.strip
if value[0] == '"'
Expand Down

0 comments on commit 4583c57

Please sign in to comment.