<commit_before>class ExactTarget
    
  public
  
  def image_import(file_path)
    @name  = File.basename(file_path)
    
    ftp_put(file_path.to_s)
    
    result = Nokogiri::XML(send(render(:image)))
    desc   = result.xpath('//filemanagement-description').text
    total  = result.xpath('//filemanagement-totalmoved').text.to_i
    name   = result.xpath('//filemanagement-info').text
    error  = desc.include?('not exist') ? 'File not found' : total < 1 ? 'Unsupported file type' : nil
    
    count  = 0
    limit  = 15
    
    begin
      sleep 0.5
      ftp_delete(@name)
    rescue
      count += 1
      retry if count < limit
    end
    
    {
      :file_path => file_path,
      :old_name  => @name,
      :new_name  => name,
      :error     => error
    }
  end<commit_msg>Fix file_name in image_upload return hash (was not being sanitized).<commit_after>class ExactTarget
    
  public
  
  def image_import(file_path)
    @name  = File.basename(file_path)
    
    ftp_put(file_path.to_s)
    
    result = Nokogiri::XML(send(render(:image)))
    desc   = result.xpath('//filemanagement-description').text
    total  = result.xpath('//filemanagement-totalmoved').text.to_i
    name   = result.xpath('//filemanagement-info').text
    error  = desc.include?('not exist') ? 'File not found' : total < 1 ? 'Unsupported file type' : nil
    
    count  = 0
    limit  = 15
    
    begin
      sleep 0.5
      ftp_delete(@name)
    rescue
      count += 1
      retry if count < limit
    end
    
    {
      :file_path => file_path.to_s,
      :old_name  => @name,
      :new_name  => name,
      :error     => error
    }
  end
{'fraction_non_alphanumeric': 0.12014563106796117, 'fraction_numerical': 0.00849514563106796, 'mean_word_length': 2.208171206225681, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '2232071', 'n_tokens_mistral': 578, 'n_tokens_neox': 566, 'n_words': 114}