mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Better error mesaging on zipfile OPML upload.
This commit is contained in:
parent
2fea152441
commit
21ef8ad631
1 changed files with 3 additions and 2 deletions
|
@ -12,6 +12,7 @@ from django.http import HttpResponse, HttpResponseRedirect
|
|||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from django.contrib.auth import login as login_user
|
||||
from mongoengine.errors import ValidationError
|
||||
from apps.reader.forms import SignupForm
|
||||
from apps.reader.models import UserSubscription
|
||||
from apps.feed_import.models import OAuthToken
|
||||
|
@ -36,10 +37,10 @@ def opml_upload(request):
|
|||
xml_opml = file.read()
|
||||
try:
|
||||
UploadedOPML.objects.create(user_id=request.user.pk, opml_file=xml_opml)
|
||||
except (UnicodeDecodeError, InvalidStringData):
|
||||
except (UnicodeDecodeError, ValidationError, InvalidStringData):
|
||||
folders = None
|
||||
code = -1
|
||||
message = "There was a Unicode decode error when reading your OPML file."
|
||||
message = "There was a Unicode decode error when reading your OPML file. Ensure it's a text file with a .opml or .xml extension. Is it a zip file?"
|
||||
|
||||
opml_importer = OPMLImporter(xml_opml, request.user)
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue