Handling another unicode decode issue in uploaded OPMLs.

This commit is contained in:
Samuel Clay 2013-05-11 23:39:46 -07:00
parent c6e9836656
commit 2a5ffb48c5

View file

@ -3,6 +3,7 @@ import pickle
import base64 import base64
from utils import log as logging from utils import log as logging
from oauth2client.client import OAuth2WebServerFlow, FlowExchangeError from oauth2client.client import OAuth2WebServerFlow, FlowExchangeError
from bson.errors import InvalidStringData
import uuid import uuid
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
# from django.db import IntegrityError # from django.db import IntegrityError
@ -36,7 +37,7 @@ def opml_upload(request):
xml_opml = file.read() xml_opml = file.read()
try: try:
uploaded_opml = UploadedOPML.objects.create(user_id=request.user.pk, opml_file=xml_opml) uploaded_opml = UploadedOPML.objects.create(user_id=request.user.pk, opml_file=xml_opml)
except UnicodeDecodeError: except (UnicodeDecodeError, InvalidStringData):
uploaded_opml = None uploaded_opml = None
folders = None folders = None
code = -1 code = -1