From 4b923c540df6b0df1e082ba4a915752bd472f1ac Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 22 Jul 2015 16:38:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E4=B8=A2=E5=A4=B1=E7=9A=84404=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index b335e1830..f5fa007a5 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -484,7 +484,18 @@ update if params[:repository_id].present? @repository = @project.repositories.find_by_identifier_param(params[:repository_id]) else - @repository = @project.repository + # 多版本库,如果一个版本库为空则去下一个 + rep_count = @project.repositories.count + if @project.repository.nil? + for i in 0..rep_count + unless @project.repositories[i].nil? + @repository = @project.repositories[i] + break + end + end + else + @repository = @project.repository + end end (render_404; return false) unless @repository @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s