diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2015-12-18 14:55:50 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-14 14:48:13 +0300 |
commit | 80a71576ba27d84b3406a8b929328359e2edc9da (patch) | |
tree | 0e16b58f207efd72c61864bc935fad9ad3dc7c59 | |
parent | 73d2c7a553ca239cdce04af793992fd579ad3e4b (diff) |
Use `Gitlab::StringPath` in CI build artifacts controller
-rw-r--r-- | app/controllers/projects/artifacts_controller.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/string_path.rb | 12 |
2 files changed, 20 insertions, 1 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index ff04e144884..c1f406e3ba5 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -15,7 +15,10 @@ class Projects::ArtifactsController < Projects::ApplicationController end def browse - @metadata = build.artifacts_metadata + path = params[:path].to_s + @paths = artifacts_metadata.map do |_artifact_file| + Gitlab::StringPath.new(path, artifacts_metadata) + end end private @@ -28,6 +31,10 @@ class Projects::ArtifactsController < Projects::ApplicationController @artifacts_file ||= build.artifacts_file end + def artifacts_metadata + @artifacts_metadata ||= build.artifacts_metadata + end + def authorize_download_build_artifacts! unless can?(current_user, :download_build_artifacts, @project) if current_user.nil? diff --git a/lib/gitlab/string_path.rb b/lib/gitlab/string_path.rb index 9ccf54bd62f..3aa6200b572 100644 --- a/lib/gitlab/string_path.rb +++ b/lib/gitlab/string_path.rb @@ -34,6 +34,18 @@ module Gitlab !directory? end + def has_parent? + raise NotImplementedError + end + + def parent + raise NotImplementedError + end + + def directories + raise NotImplementedError + end + def files raise NotImplementedError end |