diff --git a/apps/dashboard/app/controllers/transfers_controller.rb b/apps/dashboard/app/controllers/transfers_controller.rb index 2ebf2dc4ed..971cc6c354 100644 --- a/apps/dashboard/app/controllers/transfers_controller.rb +++ b/apps/dashboard/app/controllers/transfers_controller.rb @@ -1,11 +1,12 @@ -require "rclone_util" +# frozen_string_literal: true + +require 'rclone_util' # The controller for transfer pages /dashboard/transfers class TransfersController < ApplicationController - def show @transfer = Transfer.find(params[:id]) - if(@transfer) + if @transfer respond_to do |format| format.html format.json @@ -13,7 +14,7 @@ def show else respond_to do |format| format.html - format.json { render json:{ }, status: 404 } + format.json { render json: {}, status: 404 } end end end @@ -27,23 +28,24 @@ def create if from_fs == RcloneUtil::LOCAL_FS_NAME && to_fs == RcloneUtil::LOCAL_FS_NAME @transfer = PosixTransfer.build(action: body_params[:command], files: body_params[:files]) elsif ::Configuration.remote_files_enabled? - @transfer = RemoteTransfer.build(action: body_params[:command], files: body_params[:files], src_remote: from_fs, dest_remote: to_fs) + @transfer = RemoteTransfer.build(action: body_params[:command], files: body_params[:files], src_remote: from_fs, + dest_remote: to_fs) else - render json: { error_message: "Remote file support is not enabled" } + render json: { error_message: 'Remote file support is not enabled' } end - if ! @transfer.valid? + if !@transfer.valid? # error render json: { error_message: @transfer.errors.full_messages.join('. ') } elsif @transfer.synchronous? - logger.info "files: executing synchronous commmand in directory #{@transfer.from.to_s}: #{@transfer.command_str}" + logger.info "files: executing synchronous commmand in directory #{@transfer.from}: #{@transfer.command_str}" @transfer.perform respond_to do |format| format.json { render :show } end else - logger.info "files: initiating asynchronous commmand in directory #{@transfer.from.to_s}: #{@transfer.command_str}" + logger.info "files: initiating asynchronous commmand in directory #{@transfer.from}: #{@transfer.command_str}" @transfer.perform_later respond_to do |format|