Bug #5846

Format slugs are not unique

Added by Misty De Meo over 8 years ago. Updated over 5 years ago.

Status:NewStart date:10/22/2013
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:Django
Target version:-
Sponsored:No Requires documentation:
Pull Request:

Description

When creating slugs for new format, uniqueness is not validated; as a result, there will be two formats which map to the same slug and both formats will be inaccessible in the UI.

For example: create a new format called 'Raw', when a format called 'RAW' already exists, and both will be assigned the slug 'raw'.

History

#1 Updated by Courtney Mumma almost 8 years ago

  • Assignee set to Justin Simpson

#2 Updated by Justin Simpson about 7 years ago

  • Assignee changed from Justin Simpson to Holly Becker
  • Target version deleted (Release 1.1.0)

This is better now, in Archivematica 1.4.0 - it is not possible to create a 2nd format with the same slug.
However, when the user tries to do this, an exception is thrown:

MultipleObjectsReturned at /fpr/format/7-zip/
get() returned more than one Format -- it returned 2!

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/share/archivematica/dashboard/fpr/views.py" in format_detail
52. format = get_object_or_404(fprmodels.Format, slug=slug)
File "/usr/local/lib/python2.7/dist-packages/django/shortcuts/__init__.py" in get_object_or_404
113. return queryset.get(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in get
407. (self.model._meta.object_name, num))

I think this exception should be handled - show the user an error message, or else create a new entry, but add '-1' to the slug. Not sure which approach is better, I assume the former.

#3 Updated by Justin Simpson over 5 years ago

  • Assignee deleted (Holly Becker)

Also available in: Atom PDF