Skip to content

Commit

Permalink
Merge pull request #2999 from osc-bot/osc-bot/random-linted-file
Browse files Browse the repository at this point in the history
Lint a random file
  • Loading branch information
johrstrom authored Sep 1, 2023
2 parents b5cd9c4 + 3c79fb2 commit dbc3373
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions apps/dashboard/app/controllers/transfers_controller.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
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
end
else
respond_to do |format|
format.html
format.json { render json:{ }, status: 404 }
format.json { render json: {}, status: 404 }
end
end
end
Expand All @@ -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|
Expand Down

0 comments on commit dbc3373

Please sign in to comment.