diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 7064c6885..2358f9dee 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -26,10 +26,10 @@ GitHub's online interface.
For users who previously confirmed the license of their contributions on the
support site, it would be great if you could add your name below as well.
-********************
+---
AMBOSS MD Inc.
-Aristotelis P.
+Aristotelis P.
Erez Volk
zjosua
Yngve Hoiseth
@@ -160,7 +160,7 @@ Marko Sisovic
Viktor Ricci
Harvey Randall
Pedro Lameiras
-Kai Knoblich
+Kai Knoblich
Lucas Scharenbroch
Antonio Cavallo
Han Yeong-woo
@@ -189,7 +189,7 @@ Christian Donat
Asuka Minato
Dillon Baldwin
Voczi
-Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com>
+Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com>
Themis Demetriades
Luke Bartholomew
Gregory Abrasaldo
@@ -243,8 +243,9 @@ Lee Doughty <32392044+leedoughty@users.noreply.github.com>
memchr
Max Romanowski
Aldlss
+josse <112946011+josod827@users.noreply.github.com>
-********************
+---
The text of the 3 clause BSD license follows:
@@ -254,15 +255,15 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
+ list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
-may be used to endorse or promote products derived from this software without
-specific prior written permission.
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
diff --git a/qt/aqt/mediasrv.py b/qt/aqt/mediasrv.py
index 1a94912ee..c5d682af0 100644
--- a/qt/aqt/mediasrv.py
+++ b/qt/aqt/mediasrv.py
@@ -30,6 +30,7 @@ import aqt.operations
from anki import hooks
from anki.collection import OpChanges, OpChangesOnly, Progress, SearchNode
from anki.decks import UpdateDeckConfigs
+from anki.errors import BackendError
from anki.scheduler.v3 import SchedulingStatesWithContext, SetSchedulingStatesRequest
from anki.utils import dev_mode
from aqt.changenotetype import ChangeNotetypeDialog
@@ -730,6 +731,19 @@ def _extract_collection_post_request(path: str) -> DynamicRequest | NotFound:
response.headers["Content-Type"] = "application/binary"
else:
response = _text_response(HTTPStatus.NO_CONTENT, "")
+ except BackendError as e:
+ # special case empty file error from csv import
+ if "empty" in str(e).lower():
+
+ def warn() -> None:
+ show_warning(
+ "The file you selected is empty and cannot be imported."
+ )
+
+ aqt.mw.taskman.run_on_main(warn)
+ return _text_response(HTTPStatus.NO_CONTENT, "")
+ else:
+ response = _text_response(HTTPStatus.INTERNAL_SERVER_ERROR, str(e))
except Exception as exc:
print(traceback.format_exc())
response = _text_response(HTTPStatus.INTERNAL_SERVER_ERROR, str(exc))