<commit_before>class AttachmentsController < ApplicationController
  before_action :signed_in_user
  before_action :set_attachment, only: [:show, :destroy]

  def show
    authorize! :read, @attachment.list
    send_file @attachment.media.path, type: @attachment.media_content_type,
      disposition: "inline"
  end

  def create
    @list = List.find(params[:list_id])
    authorize! :update, @list
    @attachment = @list.attachments.create(attachment_params)
    redirect_to list_path(@list)<commit_msg>All users can read files (for now)<commit_after>class AttachmentsController < ApplicationController
  before_action :signed_in_user
  before_action :set_attachment, only: [:show, :destroy]

  def show
    # authorize! :read, @attachment.list
    send_file @attachment.media.path, type: @attachment.media_content_type,
      disposition: "inline"
  end

  def create
    @list = List.find(params[:list_id])
    authorize! :update, @list
    @attachment = @list.attachments.create(attachment_params)
    redirect_to list_path(@list)
{'fraction_non_alphanumeric': 0.10125361620057859, 'fraction_numerical': 0.0, 'mean_word_length': 4.8977272727272725, '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': '4428255', 'n_tokens_mistral': 320, 'n_tokens_neox': 312, 'n_words': 71}