app/controllers/stages_controller.rb
# Get uploaded content depending on method
Get uploaded content depending on method
Get uploaded content depending on method
def uploaded_file
    if params[:file].nil?
      [request.body.read, nil]
    else
      unless params[:file].respond_to?(:tempfile) && params[:file].respond_to?(:original_filename)
        raise JupyterNotebook::BadFormat, 'expected a file object'
      end
      unless params[:file].original_filename.end_with?('.ipynb')
        raise JupyterNotebook::BadFormat, 'file extension must be .ipynb'
      end
      [params[:file].tempfile.read, File.basename(params[:file].original_filename)]
    end
  end
def uploaded_file if params [ :file ] . nil? [ request . body . read , nil ] else unless params [ :file ] . respond_to? ( :tempfile ) && params [ :file ] . respond_to? ( :original_filename ) raise JupyterNotebook :: BadFormat , 'expected a file object' end unless params [ :file ] . original_filename . end_with? ( '.ipynb' ) raise JupyterNotebook :: BadFormat , 'file extension must be .ipynb' end [ params [ :file ] . tempfile . read , File . basename ( params [ :file ] . original_filename ) ] end end
Get uploaded content depending on method
Get uploaded content depending on method