Skip to content

500 error when submitting license form without license field filled

When adding a new license to GitLab EE and someone hits 'Upload license' without actually filling license key in the license data field, exception is raised.

Processing by Admin::LicensesController#create as HTML
  Parameters: {"license_type"=>"key", "license"=>{"data"=>""}}
Completed 500 Internal Server Error in 47ms (ActiveRecord: 4.6ms)

NoMethodError (undefined method `split' for nil:NilClass):
  app/models/license.rb:55:in `license'
  app/models/license.rb:62:in `license?'
  app/models/license.rb:112:in `valid_license'
  app/controllers/admin/licenses_controller.rb:31:in `block in create'
  app/controllers/admin/licenses_controller.rb:30:in `create'
  lib/gitlab/request_profiler/middleware.rb:15:in `call'
  lib/gitlab/middleware/go.rb:16:in `call'
  lib/gitlab/middleware/readonly_geo.rb:29:in `call'

Found with end-to-end test suite in gitlab/gitlab-ee:latest docker image.

2016-10-04_14.02.18