Closed Bug 613378 Opened 11 years ago Closed 11 years ago

File upload platform check


( Graveyard :: Developer Pages, defect, P3)



(Not tracked)



(Reporter: andy+bugzilla, Assigned: jbalogh)



You should not be able to upload any files if the maximum number of files/platform has been reached. For a search engine addon this is one. For other addons this is 4 (not including unsupported platforms).

This is manifest if you try to upload a file for a platform that already exists. For example on at: /en-US/developers/addon/7431/versions/84102

If you upload a file for a platform that already exists, it will complete the upload. Then you click save it will validate and give an error on the platform. The data is not enough to represent in the form and you get a traceback (below).

But we should have been able to stop the upload before then.

Traceback (most recent call last):

  File "/Users/andy/sandboxes/zamboni/vendor/src/django/django/core/servers/", line 280, in run
    self.result = application(self.environ, self.start_response)

  File "/Users/andy/sandboxes/zamboni/vendor/src/django/django/core/servers/", line 674, in __call__
    return self.application(environ, start_response)

  File "/Users/andy/sandboxes/zamboni/vendor/src/django/django/core/handlers/", line 241, in __call__
    response = self.get_response(request)

  File "/Users/andy/sandboxes/zamboni/vendor/src/django/django/core/handlers/", line 141, in get_response
    return self.handle_uncaught_exception(request, resolver, sys.exc_info())

  File "/Users/andy/sandboxes/zamboni/vendor/src/django/django/core/handlers/", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/Users/andy/sandboxes/zamboni/apps/amo/", line 77, in wrapper
    return f(*args, **kw)

  File "/Users/andy/sandboxes/zamboni/apps/amo/", line 69, in wrapper
    return f(*args, **kw)

  File "/Users/andy/sandboxes/zamboni/apps/amo/", line 24, in wrapper
    return func(request, *args, **kw)

  File "/Users/andy/sandboxes/zamboni/apps/devhub/", line 57, in wrapper
    return fun()

  File "/Users/andy/sandboxes/zamboni/apps/devhub/", line 53, in <lambda>
    fun = lambda: f(request, addon_id=addon_id, addon=addon, *args, **kw)

  File "/Users/andy/sandboxes/zamboni/apps/devhub/", line 520, in version_edit
    return jingo.render(request, 'devhub/versions/edit.html', data)

  File "/Users/andy/sandboxes/zamboni/vendor/src/jingo/jingo/", line 78, in render
    rendered = render_to_string(request, template, context)

  File "/Users/andy/sandboxes/zamboni/vendor/src/jingo/jingo/", line 96, in render_to_string
    return template.render(**get_context())

  File "/Users/andy/.virtualenvs/zamboni/lib/python2.6/site-packages/jinja2/", line 705, in render
    return self.environment.handle_exception(exc_info, True)

  File "/Users/andy/sandboxes/zamboni/apps/devhub/templates/devhub/versions/edit.html", line 5, in top-level template code
    {% set title = _('Manage Version {0}')|f(version.version) %}

  File "/Users/andy/sandboxes/zamboni/apps/devhub/templates/devhub/base.html", line 1, in top-level template code
    {% extends "base.html" %}

  File "/Users/andy/sandboxes/zamboni/templates/base.html", line 88, in top-level template code
    {% block main_content %}

  File "/Users/andy/sandboxes/zamboni/templates/base.html", line 97, in block "main_content"
    {% block content %}{% endblock %}

  File "/Users/andy/sandboxes/zamboni/apps/devhub/templates/devhub/versions/edit.html", line 31, in block "content"
    {% include "devhub/includes/version_file.html" %}

  File "/Users/andy/sandboxes/zamboni/apps/devhub/templates/devhub/includes/version_file.html", line 4, in top-level template code
    <a href="{{ file.get_url_path(amo.FIREFOX, 'devhub') }}">

  File "/Users/andy/sandboxes/zamboni/apps/files/", line 48, in get_url_path
    url = os.path.join(reverse('downloads.file', args=[]),

  File "/Users/andy/sandboxes/zamboni/apps/amo/", line 58, in reverse
    url = django_reverse(viewname, urlconf, args, kwargs, prefix, current_app)

  File "/Users/andy/sandboxes/zamboni/vendor/src/django/django/core/", line 350, in reverse
    *args, **kwargs)))

  File "/Users/andy/sandboxes/zamboni/vendor/src/django/django/core/", line 296, in reverse
    "arguments '%s' not found." % (lookup_view_s, args, kwargs))

NoReverseMatch: Reverse for 'downloads.file' with arguments '(None,)' and keyword arguments '{}' not found.
This is one of a crapton of bugs I sprinkled throughout the uploader. myamobugs says tomorrow is the time for writing tests for uploads, so this might get fixed soon.  And we'll be breaking 1000 in Hudson.  Nice bug report.
Depends on: 612371
Actually I believe that traceback is for something else.
If the existing add-on file has platform set to "ALL", then we should not allow any more file uploads for that version.
I'm ignoring the traceback.  This is fixed for everything but search engines (which shouldn't allow platform choices).
Assignee: nobody → jbalogh
Target Milestone: 5.12.4 → 5.12.5
Priority: -- → P3
andym started hiding platforms in which is good enough for me.  If people want to tamperdata and make their addon inaccessible to some people, I don't feel inclined to stop them.

Thanks andy!
Closed: 11 years ago
Resolution: --- → FIXED
Product: → Graveyard
You need to log in before you can comment on or make changes to this bug.