Skip to content

Commit 59526c9

Browse files
committed
Allow empty string as uploaded subtitles
Empty string was getting filtered out due to being falsy. Fixes that.
1 parent d512243 commit 59526c9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/SubtitleEditor.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ const UploadButton: React.FC = () => {
213213
return;
214214
}
215215

216-
// Check if image
216+
// Check if not text
217217
if (fileObj.type.split("/")[0] !== "text") {
218218
setErrorState(true);
219219
setErrorMessage(t("subtitles.uploadButton-error-filetype"));
@@ -222,8 +222,7 @@ const UploadButton: React.FC = () => {
222222

223223
const reader = new FileReader();
224224
reader.onload = e => {
225-
// the result image data
226-
if (e.target && e.target.result) {
225+
if (e.target && (e.target.result || e.target.result === "")) {
227226
try {
228227
const text = e.target.result.toString();
229228
const subtitleParsed = parseSubtitle(text);

0 commit comments

Comments
 (0)