From ab9f5fbeb25c6ca727b80daccbfd53d2459974d1 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Fri, 21 Jun 2013 20:58:44 -0700 Subject: [PATCH] A fix for the encoding issue, finally. --- app.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.rb b/app.rb index bb466ab7..33751c52 100644 --- a/app.rb +++ b/app.rb @@ -50,6 +50,7 @@ get '/new' do end get '/dashboard' do + require_login slim :'dashboard' end @@ -208,7 +209,9 @@ post '/site_files/save/:filename' do |filename| halt 'File is too large to fit in your space, it has NOT been saved. Please make a local copy and then try to reduce the size.' end - tmpfile.write request.body.read + input = request.body.read + tmpfile.set_encoding input.encoding + tmpfile.write input tmpfile.close sanitized_filename = filename.gsub(/[^a-zA-Z_\-.]/, '')