mirror of https://github.com/zulip/zulip.git
upload_widget: Fix TypeScript noUncheckedIndexedAccess errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
6c0c19addb
commit
067a342b4e
|
@ -79,9 +79,9 @@ export function build_widget(
|
|||
|
||||
get_file_input().attr("accept", supported_types.toString());
|
||||
get_file_input().on("change", (e) => {
|
||||
if (e.target.files?.length === 0) {
|
||||
if (e.target.files?.[0] === undefined) {
|
||||
$input_error.hide();
|
||||
} else if (e.target.files?.length === 1) {
|
||||
} else if (e.target.files.length === 1) {
|
||||
const file = e.target.files[0];
|
||||
if (file.size > max_file_upload_size * 1024 * 1024) {
|
||||
$input_error.text(
|
||||
|
@ -167,9 +167,9 @@ export function build_direct_upload_widget(
|
|||
|
||||
get_file_input().attr("accept", supported_types.toString());
|
||||
get_file_input().on("change", (e) => {
|
||||
if (e.target.files?.length === 0) {
|
||||
if (e.target.files?.[0] === undefined) {
|
||||
$input_error.hide();
|
||||
} else if (e.target.files?.length === 1) {
|
||||
} else if (e.target.files.length === 1) {
|
||||
const file = e.target.files[0];
|
||||
if (file.size > max_file_upload_size * 1024 * 1024) {
|
||||
$input_error.text(
|
||||
|
|
Loading…
Reference in New Issue