<commit_before>class FilesController < ApplicationController
  def upload
    if File.file?(Upload.base_upload_dir.join(params[:path]))
      case File.extname(params[:path]).downcase
      when ".jpg", ".jpeg", ".png", ".gif"
        disp = "inline"
      else
        disp = "attachment"
      end
      mime = mime_type(params[:path])
      
      send_file Upload.base_upload_dir.join(params[:path]).to_s,
                filename: File.basename(params[:path]),
                disposition: disp,
                type: mime
    else
      render 'errors/not_found', layout: 'errors', status: 404
    end
  end
end<commit_msg>fixing a 500 error code<commit_after>class FilesController < ApplicationController
  def upload
    if File.file?(Upload.base_upload_dir.join(params[:path]))
      case File.extname(params[:path]).downcase
      when ".jpg", ".jpeg", ".png", ".gif"
        disp = "inline"
      else
        disp = "attachment"
      end
      mime = mime_type(params[:path])
      
      send_file Upload.base_upload_dir.join(params[:path]).to_s,
                filename: File.basename(params[:path]),
                disposition: disp,
                type: mime
    else
      render 'errors/not_found', layout: 'errors', formats: [:html], status: 404
    end
  end
end
{'fraction_non_alphanumeric': 0.12519440124416797, 'fraction_numerical': 0.006998444790046656, 'mean_word_length': 2.395778364116095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5306176', 'n_tokens_mistral': 395, 'n_tokens_neox': 377, 'n_words': 85}