<commit_before>class Api::ImsImportsController < ApplicationController
  include Concerns::CanvasImsccSupport

  def create
    if params[:data] && params[:data][:lti_launches].present?
      lti_launches = lti_launches_params(params[:data])[:lti_launches]

      data = {
        lti_launches: lti_launches,
        context_id: params[:context_id],
        tool_consumer_instance_guid: params[:tool_consumer_instance_guid],
      }

      ImsImportJob.perform_later(data.to_json)
    end

    render json: { status: "completed" }
  end

  private

  def lti_launches_params(current_params)
    current_params.permit(
      lti_launches: [
        :token,
        config: {},<commit_msg>Verify ims import data params separately<commit_after>class Api::ImsImportsController < ApplicationController
  include Concerns::CanvasImsccSupport

  def create
    data = params[:data]
    if data.present?
      lti_launches = if data[:lti_launches].present?
                       lti_launches_params(data)[:lti_launches]
                     end

      data = {
        lti_launches: lti_launches,
        context_id: params[:context_id],
        tool_consumer_instance_guid: params[:tool_consumer_instance_guid],
      }

      ImsImportJob.perform_later(data.to_json)
    end

    render json: { status: "completed" }
  end

  private

  def lti_launches_params(current_params)
    current_params.permit(
      lti_launches: [
        :token,
        config: {},
{'fraction_non_alphanumeric': 0.0885989010989011, 'fraction_numerical': 0.0, 'mean_word_length': 3.104225352112676, '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': '4814245', 'n_tokens_mistral': 475, 'n_tokens_neox': 469, 'n_words': 75}