lib/rest-ftp-daemon/api/jobs.rb in rest-ftp-daemon-0.247.0 vs lib/rest-ftp-daemon/api/jobs.rb in rest-ftp-daemon-0.247.1

- old
+ new

@@ -21,24 +21,16 @@ ### READ ONE JOB desc "Read job with ID" params do - requires :id, type: String, desc: "ID of the Job to read"#, regexp: /[^\/]+$// + requires :id, type: String, desc: "ID of the Job to read" end - get "/*id" do + get "/:id", requirements: { id: /.*/ } do begin # Get job to display raise RestFtpDaemon::JobNotFound if params[:id].nil? - - # Find using matched parts - if params[:format] - job = $queue.find_by_id("#{params[:id]}.#{params[:format]}", false) - else - job = $queue.find_by_id(params[:id], true) - end - - # Fail if none found + job = $queue.find_by_id(params[:id]) || $queue.find_by_id(params[:id], true) raise RestFtpDaemon::JobNotFound if job.nil? rescue RestFtpDaemon::JobNotFound => exception log_error "JobNotFound: #{exception.message}" error!({ error: :api_job_not_found, message: exception.message }, 404)