diff options
author | Martin Cabrera <martin@kisland.com> | 2017-01-16 20:24:21 +0100 |
---|---|---|
committer | Martin Cabrera <martin@kisland.com> | 2017-01-16 20:24:21 +0100 |
commit | fe4c2b8b75ca109fe76db34dd56b70d57721fab9 (patch) | |
tree | 828847642fdc8a0b59e0bcd31eb633dacf654d9a /lib/api | |
parent | 9844c1f222fa910fc5fe23de0821c83a095d84f9 (diff) | |
parent | 79373bdc5c025f189f3f17162945765a2617e820 (diff) | |
download | gitlab-ce-fe4c2b8b75ca109fe76db34dd56b70d57721fab9.tar.gz |
Merge branch 'master' into i-#25814-500-error
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/helpers.rb | 2 | ||||
-rw-r--r-- | lib/api/projects.rb | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 20b5bc1502a..eb2d370c68e 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -294,7 +294,7 @@ module API header['X-Sendfile'] = path body else - file FileStreamer.new(path) + path end end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 3be14e8eb76..941f47114a4 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -159,7 +159,7 @@ module API use :sort_params use :pagination end - get "/search/:query" do + get "/search/:query", requirements: { query: /[^\/]+/ } do search_service = Search::GlobalService.new(current_user, search: params[:query]).execute projects = search_service.objects('projects', params[:page]) projects = projects.reorder(params[:order_by] => params[:sort]) @@ -295,13 +295,13 @@ module API authorize! :rename_project, user_project if attrs[:name].present? authorize! :change_visibility_level, user_project if attrs[:visibility_level].present? - ::Projects::UpdateService.new(user_project, current_user, attrs).execute + result = ::Projects::UpdateService.new(user_project, current_user, attrs).execute - if user_project.errors.any? - render_validation_error!(user_project) - else + if result[:status] == :success present user_project, with: Entities::Project, user_can_admin_project: can?(current_user, :admin_project, user_project) + else + render_validation_error!(user_project) end end |