  def update_attachment_info
    Log.add_info(request, params.inspect)

    return unless request.post?

    attachment = Attachment.find(params[:attachment_id])

    # Getting Item at first for the case of resetting the db connection by an error.
    @item = Item.find(attachment.item_id)

    unless @item.check_user_auth(@login_user, 'w', true)
      raise t('msg.need_to_be_owner')
    end

    if !params[:attachment][:file].nil? and params[:attachment][:file].size == 0
      params[:attachment].delete(:file)
    end
    unless attachment.update_attributes(params.require(:attachment).permit(Attachment::PERMIT_BASE))
      @attachment = attachment
      render(:partial => 'ajax_item_attachment', :layout => false)
      return
    end

    @item = Item.find(attachment.item_id)
    @item.update_attribute(:updated_at, Time.now)

    render(:partial => 'ajax_item_attachment', :layout => false)

  rescue => evar
    Log.add_error(request, evar)

    @attachment = Attachment.new
    @attachment.errors.add_to_base(evar.to_s[0, 256])

    render(:partial => 'ajax_item_attachment', :layout => false)
  end
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.