diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index e180ee781..bd35b5a4d 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -36,13 +36,13 @@ class GamesController < ApplicationController # 默认打开文件 logger.info("repository id is #{@repository.id}, repository's shixun_id =#{@repository.myshixun_id} shixun_id =#{@repository.shixun_id}, project_id => #{@repository.project_id}") # 验证challenge文件名的合法性 - if !challenge_path.blank? && challenge_path.include?(".") && @path.include?(".") && @type != "root" + if @path.blank? && !challenge_path.blank? && challenge_path.include?(".") && @type != "root" @path = challenge_path.strip file_content = @g.files(@myshixun.gpid, @path, @rev).content if file_content.blank? # gitlab缺陷:forked完成,短暂时间内取不了内容的,所以做一个小轮询,间隔0.1秒 # 超过2秒则失败,需通过页面刷新 - for i in 0..10 do + for i in 0..20 do sleep(0.1) file_content = @g.files(@myshixun.gpid, @path, @rev).content unless file_content.blank?