Ticket #1742 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

Naming of a new package/group can clash with a route

Reported by: ross Owned by: ross
Priority: trivial Milestone: ckan-sprint-2012-03-19
Component: ckan Keywords: [1d][a:0.5d]
Cc: Repository: ckan
Theme: none

Description

It is possible to create a group or a dataset called new, or edit, which will then be inaccessible as it is blocked by the existing routes with those names.

We should maintain a list of invalid names in the verification that happens behind the scenes in the UI.

Change History

comment:1 Changed 2 years ago by ross

Potentially valid diff, needs test + patch when I have time.

--- a/ckan/controllers/api.py +++ b/ckan/controllers/api.py @@ -592,6 +592,8 @@ class ApiController?(BaseController?):

def is_slug_valid(self):

slug = request.params.get('slug') or slugtype = request.params.get('type') or

+ if slug in ['new', 'edit', 'search']: + return self._finish_ok( dict(valid=False) )

if slugtype==u'package':

response_data = dict(valid=not bool(package_exists(slug))) return self._finish_ok(response_data)

comment:2 Changed 2 years ago by dread

  • Priority changed from awaiting triage to trivial

Probably better in the ckan/logic/validators.py: name_validator

comment:3 Changed 2 years ago by ross

  • Status changed from new to assigned
  • Milestone changed from ckan-backlog to current-ckan-sprint-2012-03-19

comment:4 Changed 2 years ago by ross

  • Keywords [1d] added

comment:5 Changed 2 years ago by ross

  • Keywords [1d][a:0.5d] added; [1d] removed
  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.