Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
b5f8da38
Commit
b5f8da38
authored
3 years ago
by
Israel Barreto Sant'Anna
Browse files
Options
Downloads
Patches
Plain Diff
Fix render error in package_controller
parent
f4b0ac6b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/controllers/v1/packages_controller.rb
+9
-6
9 additions, 6 deletions
app/controllers/v1/packages_controller.rb
with
9 additions
and
6 deletions
app/controllers/v1/packages_controller.rb
+
9
−
6
View file @
b5f8da38
...
...
@@ -21,12 +21,16 @@ class V1::PackagesController < ApplicationController
before_action
:set_objects
def
link
response
=
PackageService
.
link
(
@objects
)
if
response
.
nil?
if
@objects
.
blank?
render
status: :not_found
else
render
json:
{
url:
response
},
status: :found
response
=
PackageService
.
link
(
@objects
)
if
response
.
nil?
render
status: :not_found
else
render
json:
{
url:
response
},
status: :found
end
end
end
...
...
@@ -34,11 +38,10 @@ class V1::PackagesController < ApplicationController
def
set_objects
allowed
=
PackageService
.
allowed_classes
@objects
=
objects_params
[
:object
].
map
do
|
o
|
next
unless
allowed
.
include?
o
[
'type'
]
obj
=
o
[
'type'
].
constantize
.
where
(
id:
o
[
'id'
]).
first
re
nder
status: :not_found
if
@obj
.
blank?
b
re
ak
if
@obj
.
blank?
obj
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment