<commit_before>
class InlineFileUpload < HashModel
  attributes :file_id => nil, :object => nil, :field => nil, :url => nil, :folder_id => nil, :from => 'computer'

  validates_presence_of :file_id
  validates_presence_of :object
  validates_presence_of :file_id

  integer_options :folder_id
  domain_file_options :file_id

  def handle_file_upload(renderer, params)
    uri = nil
    begin
      uri = URI.parse(params[:file][:url])
    rescue
    end

    if uri
      begin
        domain_file = DomainFile.create :filename => uri, :creator_id => renderer.myself.id
        params[:file][:file_id] = domain_file.id if domain_file.id
        self.file_id = domain_file.id
      rescue Exception => e
        Rails.logger.error e
      end
    else
      renderer.handle_file_upload(params[:file], 'file_id', {:folder => self.folder_id})
      self.file_id = params[:file][:file_id]<commit_msg>Fix, downloaded file was not being stored in the correct folder.<commit_after>
class InlineFileUpload < HashModel
  attributes :file_id => nil, :object => nil, :field => nil, :url => nil, :folder_id => nil, :from => 'computer'

  validates_presence_of :file_id
  validates_presence_of :object
  validates_presence_of :file_id

  integer_options :folder_id
  domain_file_options :file_id

  def handle_file_upload(renderer, params)
    uri = nil
    begin
      uri = URI.parse(params[:file][:url])
    rescue
    end

    if uri
      begin
        domain_file = DomainFile.create :filename => uri, :creator_id => renderer.myself.id, :parent_id => self.folder_id
        params[:file][:file_id] = domain_file.id if domain_file.id
        self.file_id = domain_file.id
      rescue Exception => e
        Rails.logger.error e
      end
    else
      renderer.handle_file_upload(params[:file], 'file_id', {:folder => self.folder_id})
      self.file_id = params[:file][:file_id]
{'fraction_non_alphanumeric': 0.10945008008542445, 'fraction_numerical': 0.0, 'mean_word_length': 3.419811320754717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6590591', 'n_tokens_mistral': 621, 'n_tokens_neox': 611, 'n_words': 141}