diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index a1991e2e..2cf5294d 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -54,6 +54,7 @@ const currentVisibility = $computed(() => { }) let isUploading = $ref(false) +let failed = $ref([]) async function handlePaste(evt: ClipboardEvent) { const files = evt.clipboardData?.files @@ -98,11 +99,19 @@ const masto = useMasto() async function uploadAttachments(files: File[]) { isUploading = true + failed = [] for (const file of files) { - const attachment = await masto.mediaAttachments.create({ - file, - }) - draft.attachments.push(attachment) + try { + const attachment = await masto.mediaAttachments.create({ + file, + }) + draft.attachments.push(attachment) + } + catch (e) { + // TODO: add some human-readable error message, problem is that masto api will not return response code + console.error(e) + failed = [...failed, file] + } } isUploading = false } @@ -220,6 +229,36 @@ defineExpose({
{{ $t('state.uploading') }}
+
+ +
+ + + + + +
    +
  1. + {{ file.name }} +
  2. +
+