scrub file path

This commit is contained in:
Kyle Drake 2019-10-07 00:10:11 -07:00
parent 013086d3bc
commit 895d059942

View file

@ -125,13 +125,12 @@ post '/site_files/upload' do
unless params[:file_paths].nil? || params[:file_paths].empty? || params[:file_paths].length == 0 unless params[:file_paths].nil? || params[:file_paths].empty? || params[:file_paths].length == 0
file_path = params[:file_paths][i] file_path = params[:file_paths][i]
unless file_path.nil? unless file_path.nil?
dir_name += '/' + Pathname(file_path).dirname.to_s dir_name += '/' + Pathname(file_path).dirname.to_s
end end
end end
file[:filename] = "#{dir_name}/#{file[:filename]}" file[:filename] = "#{dir_name}/#{site.scrubbed_path file[:filename]}"
if current_site.file_size_too_large? file[:tempfile].size if current_site.file_size_too_large? file[:tempfile].size
file_upload_response "#{file[:filename]} is too large, upload cancelled." file_upload_response "#{file[:filename]} is too large, upload cancelled."
end end