Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #9: Validate file size before content type #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

trawick
Copy link

@trawick trawick commented Jan 6, 2016

Aside from the fact that checking size is cheaper, this change fixes a misleading and confusing message described in issue #9, where a user uploading a MS Word .doc file which is too big is told incorrectly that the content type is wrong.

The tests were changed to work (only) with Django 1.6 and above, which changed humanize to add a non-breaking space (\xa0) between a value and its unit. See this ticket for more
details:

I tested with these dependencies along with Python 2.7.6:

  • Django==1.6.11
  • python-magic==0.4.10

Aside from the fact that checking size is cheaper, this change fixes
a misleading and confusing message described in issue kaleidos#9, where a
user uploading a MS Word .doc file which is too big is told incorrectly
that the content type is wrong.

The tests were changed to work (only) with Django 1.6 and
above, which changed humanize to add a non-breaking space (\xa0)
between a value and its unit.  See this ticket for more
details:

  https://code.djangoproject.com/ticket/20246

I tested with these dependencies along with Python 2.7.6:

  Django==1.6.11
  python-magic==0.4.10
@trawick
Copy link
Author

trawick commented Jan 6, 2016

The Travis test fails for the same reason my local attempt with Django 1.7 failed:

AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.

(common migration issue with Django 1.7 -- the Travis setup uses a level of Django with which the base tests fail)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant