app/controllers/shares_controller.rb
# GET /f/:user_id/:original_filename
# Uploads files from local path for given user and show file by name
GET /f/:user_id/:original_filename
Uploads files from local path for given user and show file by name
GET / f / : user_id / : original_filename Uploads files from local path for given user and show file by name
def show_by_name
    begin
      @user = User.find(params[:user_id])
      @user.upload_from_local_path
      @share = @user.shares.find_by_original_filename!(params[:original_filename]+'.'+params[:extension])
      unless @share.public? or (signed_in? and current_user == @share.user) or (signed_in? and current_user.admin?)
        redirect_to root_path, alert: t('messages.no_access')
      else
        render 'show.html.slim'
      end
    rescue ActiveRecord::RecordNotFound
      return route_not_found
    end
  end
def show_by_name begin @user = User . find ( params [ :user_id ] ) @user . upload_from_local_path @share = @user . shares . find_by_original_filename! ( params [ :original_filename ] + '.' + params [ :extension ] ) unless @share . public? or ( signed_in? and current_user == @share . user ) or ( signed_in? and current_user . admin? ) redirect_to root_path , alert : t ( 'messages.no_access' ) else render 'show.html.slim' end rescue ActiveRecord :: RecordNotFound return route_not_found end end
GET /f/:user_id/:original_filename
Uploads files from local path for given user and show file by name
GET / f / : user_id / : original_filename Uploads files from local path for given user and show file by name