From 853096634db2259eb341d9715f5d4ca9b1502cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Zrim=C5=A1ek?= Date: Fri, 26 May 2017 11:13:27 +0200 Subject: [PATCH] Fixed permission error while cloning workflows. [fixes SCI-1291] --- app/controllers/canvas_controller.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controllers/canvas_controller.rb b/app/controllers/canvas_controller.rb index 3b4b0c93a..4f0291a64 100644 --- a/app/controllers/canvas_controller.rb +++ b/app/controllers/canvas_controller.rb @@ -73,10 +73,10 @@ class CanvasController < ApplicationController poss = update_params[:positions].split(";") center = "" (poss.collect { |pos| pos.split(",") }).each_with_index do |pos, index| - unless (pos.length == 3 and - pos[0].is_a? String and - is_int? pos[1] and - is_int? pos[2]) + unless pos.length == 3 && + pos[0].is_a?(String) && + float?(pos[1]) && + float?(pos[2]) error = true break end @@ -318,4 +318,9 @@ class CanvasController < ApplicationController /\A[-+]?\d+\z/ === val end + def float?(val) + true if Float(val) + rescue ArgumentError + false + end end