Skip to content

Commit

Permalink
Not all clients send Content-Type, therefore check before creating a …
Browse files Browse the repository at this point in the history
…converter

Signed-off-by: Colin Shea <colin@evaryont.me>
  • Loading branch information
nogweii committed Aug 28, 2009
1 parent 00db43a commit a521ad7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/mouseHole/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ def initialize(uri, status, headers)
@status = status
@input = Camping.qsp(uri.query)
@headers = PageHeaders[*headers]
ctype = @headers['Content-Type'].split(";")
ctype = ctype.first if ctype.respond_to? :first
if ctype
@converter = Converters.detect_by_mime_type ctype
if @headers['Content-Type']
ctype = @headers['Content-Type'].split(";")
ctype = ctype.first if ctype.respond_to? :first
if ctype
@converter = Converters.detect_by_mime_type ctype
end
end
end

Expand Down

0 comments on commit a521ad7

Please sign in to comment.