summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-14 16:19:29 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-14 16:19:29 +0200
commit006b65098806fde2a467d9a79347d2978c992e89 (patch)
tree344377e66de454b7be77f775cd37fcf41e0f6bc0 /app/controllers/projects
parentdc41a933f4f9a79e7160e38f248d33d7beb99bb6 (diff)
parentd4cd6dcaa024f8eca9089e67fb9b97022696d3e0 (diff)
downloadgitlab-ce-006b65098806fde2a467d9a79347d2978c992e89.tar.gz
Merge remote-tracking branch 'origin/master' into environments-and-deployments
# Conflicts: # db/schema.rb
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/artifacts_controller.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb
index 832d7deb57d..f11c8321464 100644
--- a/app/controllers/projects/artifacts_controller.rb
+++ b/app/controllers/projects/artifacts_controller.rb
@@ -1,22 +1,18 @@
class Projects::ArtifactsController < Projects::ApplicationController
layout 'project'
before_action :authorize_read_build!
+ before_action :authorize_update_build!, only: [:keep]
+ before_action :validate_artifacts!
def download
unless artifacts_file.file_storage?
return redirect_to artifacts_file.url
end
- unless artifacts_file.exists?
- return render_404
- end
-
send_file artifacts_file.path, disposition: 'attachment'
end
def browse
- return render_404 unless build.artifacts?
-
directory = params[:path] ? "#{params[:path]}/" : ''
@entry = build.artifacts_metadata_entry(directory)
@@ -34,8 +30,17 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
end
+ def keep
+ build.keep_artifacts!
+ redirect_to namespace_project_build_path(project.namespace, project, build)
+ end
+
private
+ def validate_artifacts!
+ render_404 unless build.artifacts?
+ end
+
def build
@build ||= project.builds.find_by!(id: params[:build_id])
end