Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Label damaged PDFs and offer Repair (#8589)

Reece Brownecb7b58a2c0c0
diff --git a/frontend/editor/public/locales/ar-AR/translation.toml b/frontend/editor/public/locales/ar-AR/translation.toml
index 7ca91249f4..96469f8f33 100644
--- a/frontend/editor/public/locales/ar-AR/translation.toml
+++ b/frontend/editor/public/locales/ar-AR/translation.toml
@@ -4285,6 +4285,13 @@ precision = "استخدم مدخلات الإحداثيات للتموضع ال
resize = "اسحب مقابض الزوايا والحواف لتغيير الحجم"
title = "كيفية قص ملفات PDF"
+[damagedPdf]
+description = "ملف PDF هذا تالف ولا يمكن فتحه."
+label = "تالف"
+repair = "إصلاح"
+repaired = "تم إصلاح {{name}}"
+repairFailed = "تعذّر إصلاح {{name}}"
+
[database]
backupCreated = "تم إنشاء نسخة احتياطية لقاعدة البيانات بنجاح"
fileName = "اسم الملف"
@@ -14052,6 +14059,7 @@ closeAll = "إغلاق كل الملفات"
closePdf = "إغلاق PDF"
deselectAll = "إلغاء تحديد الكل"
downloadAll = "تنزيل الكل"
+exitAnnotations = "الخروج من وضع التعليقات التوضيحية"
exitRedaction = "إنهاء وضع التنقيح"
formFill = "محرر النماذج"
hideToolbar = "إخفاء شريط الأدوات"
diff --git a/frontend/editor/public/locales/az-AZ/translation.toml b/frontend/editor/public/locales/az-AZ/translation.toml
index 2771570330..fd323f8bb2 100644
--- a/frontend/editor/public/locales/az-AZ/translation.toml
+++ b/frontend/editor/public/locales/az-AZ/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Dəqiq yerləşdirmə üçün koordinat girişlərindən istifadə
resize = "Ölçünü dəyişmək üçün künc və kənar tutacaqlarını sürüşdürün"
title = "PDF-ləri necə kəsmək olar"
+[damagedPdf]
+description = "Bu PDF zədələnib və açıla bilmir."
+label = "Zədələnmiş"
+repair = "Bərpa et"
+repaired = "{{name}} bərpa edildi"
+repairFailed = "{{name}} bərpa edilə bilmədi"
+
[database]
backupCreated = "Verilənlər bazasının ehtiyat nüsxəsi uğurla yaradıldı"
fileName = "Fayl Adı"
@@ -14052,6 +14059,7 @@ closeAll = "Bütün faylları bağla"
closePdf = "PDF-i bağla"
deselectAll = "Hamısını seçmə"
downloadAll = "Hamısını endir"
+exitAnnotations = "Annotasiya rejimindən çıx"
exitRedaction = "Gizlətmə rejimindən çıx"
formFill = "Forma Redaktoru"
hideToolbar = "Alətlər panelini gizlət"
diff --git a/frontend/editor/public/locales/bg-BG/translation.toml b/frontend/editor/public/locales/bg-BG/translation.toml
index d714da8939..c2a3d2c8fa 100644
--- a/frontend/editor/public/locales/bg-BG/translation.toml
+++ b/frontend/editor/public/locales/bg-BG/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Използвайте координатите за прецизн
resize = "Плъзнете ъгловите и страничните дръжки за преоразмеряване"
title = "Как да изрязвате PDF-и"
+[damagedPdf]
+description = "Този PDF е повреден и не може да бъде отворен."
+label = "Повреден"
+repair = "Поправи"
+repaired = "Поправен {{name}}"
+repairFailed = "Не можа да се поправи {{name}}"
+
[database]
backupCreated = "Успешно архивиране на базата данни"
fileName = "Име на файл"
@@ -14052,6 +14059,7 @@ closeAll = "Затваряне на всички файлове"
closePdf = "Затваряне на PDF"
deselectAll = "Премахване на избора от всички"
downloadAll = "Изтегляне на всички"
+exitAnnotations = "Изход от режим на анотации"
exitRedaction = "Изход от режим на заличаване"
formFill = "Редактор на формуляри"
hideToolbar = "Скриване на лентата с инструменти"
diff --git a/frontend/editor/public/locales/bo-CN/translation.toml b/frontend/editor/public/locales/bo-CN/translation.toml
index 3ffebef207..a8136e002d 100644
--- a/frontend/editor/public/locales/bo-CN/translation.toml
+++ b/frontend/editor/public/locales/bo-CN/translation.toml
@@ -4285,6 +4285,13 @@ precision = "ངེས་གཏན་གྱི་གནས་ཡུལ་ལ་
resize = "ཟུར་ཁུག་དང་མཐའ་མཚམས་ཀྱི་ལག་ཆ་དེ་ཚད་གཞི་ཆེ་རུ་གཏོང་བར་འདྲུད་རོགས།"
title = "སོན་འདེབས་བྱེད་སྟངས།"
+[damagedPdf]
+description = "PDF འདི་སྐྱོན་ཤོར་ཡོད་པས་ཁ་ཕྱེ་མི་ཐུབ།"
+label = "སྐྱོན་ཤོར"
+repair = "ཉམས་གསོ"
+repaired = "{{name}} ཉམས་གསོ་བྱས་ཟིན།"
+repairFailed = "{{name}} ཉམས་གསོ་བྱེད་མ་ཐུབ།"
+
[database]
backupCreated = "གཞི་གྲངས་མཛོད་ཀྱི་རྒྱབ་རྟེན་ལེགས་འགྲུབ་བྱུང་བ།"
fileName = "ཡིག་ཆའི་མིང་།"
@@ -14052,6 +14059,7 @@ closeAll = "ཡིག་ཆ་ཚང་མ་ཁ་བསྡམས"
closePdf = "PDF ཁ་བསྡམས"
deselectAll = "ཚང་མ་འདེམས་པ་བཤོལ"
downloadAll = "ཚང་མ་ཕབ་ལེན"
+exitAnnotations = "མཆན་འགྲེལ་རྣམ་པ་ནས་ཕྱིར་འཐོན"
exitRedaction = "སྦ་བཅོས་ཐབས་ལམ་ནས་ཕྱིར་ཐོན"
formFill = "འགེངས་ཤོག་རྩོམ་སྒྲིག་ཆས།"
hideToolbar = "ལག་ཆའི་སྒྲོམ་སྦས།"
diff --git a/frontend/editor/public/locales/ca-CA/translation.toml b/frontend/editor/public/locales/ca-CA/translation.toml
index 1a8f5b9e22..f6e8d5a8b7 100644
--- a/frontend/editor/public/locales/ca-CA/translation.toml
+++ b/frontend/editor/public/locales/ca-CA/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Utilitzeu les entrades de coordenades per a un posicionament precí
resize = "Arrossegueu les nanses de les cantonades i vores per redimensionar"
title = "Com retallar PDFs"
+[damagedPdf]
+description = "Aquest PDF està danyat i no es pot obrir."
+label = "Danyat"
+repair = "Reparar"
+repaired = "S'ha reparat {{name}}"
+repairFailed = "No s'ha pogut reparar {{name}}"
+
[database]
backupCreated = "Còpia de seguretat de la base de dades creada correctament"
fileName = "Nom del Fitxer"
@@ -14052,6 +14059,7 @@ closeAll = "Tanca tots els fitxers"
closePdf = "Tanca el PDF"
deselectAll = "Desselecciona-ho tot"
downloadAll = "Descarrega-ho tot"
+exitAnnotations = "Surt del mode d'anotació"
exitRedaction = "Surt del mode de censura"
formFill = "Editor de formularis"
hideToolbar = "Amaga la barra d'eines"
diff --git a/frontend/editor/public/locales/cs-CZ/translation.toml b/frontend/editor/public/locales/cs-CZ/translation.toml
index 295809b0da..24781c751e 100644
--- a/frontend/editor/public/locales/cs-CZ/translation.toml
+++ b/frontend/editor/public/locales/cs-CZ/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Pro přesné umístění použijte zadání souřadnic"
resize = "Změnu velikosti proveďte tažením za rohy a hrany"
title = "Jak ořezávat PDF"
+[damagedPdf]
+description = "Tento PDF soubor je poškozený a nelze jej otevřít."
+label = "Poškozený"
+repair = "Opravit"
+repaired = "Opraveno {{name}}"
+repairFailed = "Nepodařilo se opravit {{name}}"
+
[database]
backupCreated = "Záloha databáze byla úspěšná"
fileName = "Název souboru"
@@ -14052,6 +14059,7 @@ closeAll = "Zavřít všechny soubory"
closePdf = "Zavřít PDF"
deselectAll = "Zrušit výběr všech"
downloadAll = "Stáhnout vše"
+exitAnnotations = "Ukončit režim anotací"
exitRedaction = "Opustit režim začernění"
formFill = "Editor formulářů"
hideToolbar = "Skrýt panel nástrojů"
diff --git a/frontend/editor/public/locales/da-DK/translation.toml b/frontend/editor/public/locales/da-DK/translation.toml
index 7f7598268c..d6083e460e 100644
--- a/frontend/editor/public/locales/da-DK/translation.toml
+++ b/frontend/editor/public/locales/da-DK/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Brug koordinatfelterne for præcis placering"
resize = "Træk hjørne- og kantgrebene for at ændre størrelse"
title = "Sådan beskærer du PDF'er"
+[damagedPdf]
+description = "Denne PDF er beskadiget og kan ikke åbnes."
+label = "Beskadiget"
+repair = "Reparer"
+repaired = "Repareret {{name}}"
+repairFailed = "Kunne ikke reparere {{name}}"
+
[database]
backupCreated = "Databasebackup lykkedes"
fileName = "Filnavn"
@@ -14052,6 +14059,7 @@ closeAll = "Luk alle filer"
closePdf = "Luk PDF"
deselectAll = "Fravælg alle"
downloadAll = "Download alle"
+exitAnnotations = "Afslut annoteringstilstand"
exitRedaction = "Afslut maskeringstilstand"
formFill = "Formulareditor"
hideToolbar = "Skjul værktøjslinje"
diff --git a/frontend/editor/public/locales/de-DE/translation.toml b/frontend/editor/public/locales/de-DE/translation.toml
index 0c38550ea9..4a61ebf598 100644
--- a/frontend/editor/public/locales/de-DE/translation.toml
+++ b/frontend/editor/public/locales/de-DE/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Verwenden Sie Koordinateneingaben für präzise Positionierung"
resize = "Ziehen Sie die Eck- und Kantengriffe, um die Größe zu ändern"
title = "PDFs zuschneiden - Anleitung"
+[damagedPdf]
+description = "Dieses PDF ist beschädigt und kann nicht geöffnet werden."
+label = "Beschädigt"
+repair = "Reparieren"
+repaired = "{{name}} repariert"
+repairFailed = "{{name}} konnte nicht repariert werden"
+
[database]
backupCreated = "Datenbanksicherung erfolgreich"
fileName = "Dateiname"
@@ -14052,6 +14059,7 @@ closeAll = "Alle Dateien schließen"
closePdf = "PDF schließen"
deselectAll = "Alle abwählen"
downloadAll = "Alle herunterladen"
+exitAnnotations = "Anmerkungsmodus beenden"
exitRedaction = "Schwärzungsmodus beenden"
formFill = "Formular-Editor"
hideToolbar = "Toolbar ausblenden"
diff --git a/frontend/editor/public/locales/el-GR/translation.toml b/frontend/editor/public/locales/el-GR/translation.toml
index 78f838d136..8f9c02bf9c 100644
--- a/frontend/editor/public/locales/el-GR/translation.toml
+++ b/frontend/editor/public/locales/el-GR/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Χρησιμοποιήστε τα πεδία συντεταγμέν
resize = "Σύρετε τις γωνίες και τα άκρα για αλλαγή μεγέθους"
title = "Πώς να περικόψετε PDF"
+[damagedPdf]
+description = "Αυτό το PDF είναι κατεστραμμένο και δεν μπορεί να ανοίξει."
+label = "Κατεστραμμένο"
+repair = "Επιδιόρθωση"
+repaired = "Επιδιορθώθηκε το {{name}}"
+repairFailed = "Δεν ήταν δυνατή η επιδιόρθωση του {{name}}"
+
[database]
backupCreated = "Επιτυχής δημιουργία αντιγράφου ασφαλείας βάσης δεδομένων"
fileName = "Όνομα αρχείου"
@@ -14052,6 +14059,7 @@ closeAll = "Κλείσιμο όλων των αρχείων"
closePdf = "Κλείσιμο PDF"
deselectAll = "Αναίρεση επιλογής όλων"
downloadAll = "Λήψη όλων"
+exitAnnotations = "Έξοδος από τη λειτουργία σχολιασμού"
exitRedaction = "Έξοδος από λειτουργία απόκρυψης"
formFill = "Επεξεργαστής φορμών"
hideToolbar = "Απόκρυψη toolbar"
diff --git a/frontend/editor/public/locales/en-US/translation.toml b/frontend/editor/public/locales/en-US/translation.toml
index cd0a91ed6f..c8eb2aee89 100644
--- a/frontend/editor/public/locales/en-US/translation.toml
+++ b/frontend/editor/public/locales/en-US/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Use coordinate inputs for precise positioning"
resize = "Drag the corner and edge handles to resize"
title = "How to Crop PDFs"
+[damagedPdf]
+description = "This PDF is damaged and can't be opened."
+label = "Damaged"
+repair = "Repair"
+repaired = "Repaired {{name}}"
+repairFailed = "Couldn't repair {{name}}"
+
[database]
backupCreated = "Database backup successful"
fileName = "File Name"
diff --git a/frontend/editor/public/locales/es-ES/translation.toml b/frontend/editor/public/locales/es-ES/translation.toml
index 80c1266ef5..3edad845f7 100644
--- a/frontend/editor/public/locales/es-ES/translation.toml
+++ b/frontend/editor/public/locales/es-ES/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Usa entradas de coordenadas para un posicionamiento preciso"
resize = "Arrastre las esquinas y bordes para redimensionar"
title = "Cómo Recortar PDFs"
+[damagedPdf]
+description = "Este PDF está dañado y no se puede abrir."
+label = "Dañado"
+repair = "Reparar"
+repaired = "{{name}} reparado"
+repairFailed = "No se pudo reparar {{name}}"
+
[database]
backupCreated = "Respaldo de la Base de Datos exitoso"
fileName = "Nombre de Archivo"
@@ -14052,6 +14059,7 @@ closeAll = "Cerrar todos los archivos"
closePdf = "Cerrar PDF"
deselectAll = "Deseleccionar todo"
downloadAll = "Descargar todo"
+exitAnnotations = "Salir del modo de anotación"
exitRedaction = "Salir del modo de redacción"
formFill = "Editor de formularios"
hideToolbar = "Ocultar barra de herramientas"
diff --git a/frontend/editor/public/locales/eu-ES/translation.toml b/frontend/editor/public/locales/eu-ES/translation.toml
index 233643927d..6baa38c9fe 100644
--- a/frontend/editor/public/locales/eu-ES/translation.toml
+++ b/frontend/editor/public/locales/eu-ES/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Erabili koordenatu-sarrerak kokapen zehatza lortzeko"
resize = "Arrastatu izkinetako eta ertz-helmugen heldulekuak tamaina aldatzeko"
title = "Nola moztu PDFak"
+[damagedPdf]
+description = "PDF hau kaltetuta dago eta ezin da ireki."
+label = "Kaltetuta"
+repair = "Konpondu"
+repaired = "{{name}} konponduta"
+repairFailed = "Ezin izan da {{name}} konpondu"
+
[database]
backupCreated = "Datu-basearen babeskopia ongi eginda"
fileName = "Fitxategi-izena"
@@ -14052,6 +14059,7 @@ closeAll = "Itxi fitxategi guztiak"
closePdf = "Itxi PDFa"
deselectAll = "Kendu hautaketa guztia"
downloadAll = "Deskargatu dena"
+exitAnnotations = "Irten anotazio modutik"
exitRedaction = "Irten zentsura modutik"
formFill = "Inprimaki-editorea"
hideToolbar = "Ezkutatu tresna-barra"
diff --git a/frontend/editor/public/locales/fa-IR/translation.toml b/frontend/editor/public/locales/fa-IR/translation.toml
index d73f05d750..70d5608959 100644
--- a/frontend/editor/public/locales/fa-IR/translation.toml
+++ b/frontend/editor/public/locales/fa-IR/translation.toml
@@ -4285,6 +4285,13 @@ precision = "برای تعیین موقعیت دقیق از ورودی‌های
resize = "برای تغییر اندازه، گوشه‌ها و لبه‌ها را بکشید"
title = "چگونه PDF را برش دهیم"
+[damagedPdf]
+description = "این PDF آسیب‌دیده است و نمی‌توان آن را باز کرد."
+label = "آسیب‌دیده"
+repair = "ترمیم"
+repaired = "{{name}} ترمیم شد"
+repairFailed = "امکان ترمیم {{name}} وجود نداشت"
+
[database]
backupCreated = "پشتیبان‌گیری پایگاه‌داده با موفقیت انجام شد"
fileName = "نام فایل"
@@ -14052,6 +14059,7 @@ closeAll = "بستن همهٔ فایل‌ها"
closePdf = "بستن PDF"
deselectAll = "لغو انتخاب همه"
downloadAll = "دانلود همه"
+exitAnnotations = "خروج از حالت حاشیه‌نویسی"
exitRedaction = "خروج از حالت پنهان‌سازی"
formFill = "ویرایشگر فرم"
hideToolbar = "پنهان کردن نوار ابزار"
diff --git a/frontend/editor/public/locales/fr-FR/translation.toml b/frontend/editor/public/locales/fr-FR/translation.toml
index 82a6e7b8c9..f7f32559c6 100644
--- a/frontend/editor/public/locales/fr-FR/translation.toml
+++ b/frontend/editor/public/locales/fr-FR/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Utilisez les champs de coordonnées pour un positionnement précis"
resize = "Faites glisser les poignées d’angle et de bord pour redimensionner"
title = "Comment recadrer des PDF"
+[damagedPdf]
+description = "Ce PDF est endommagé et ne peut pas être ouvert."
+label = "Endommagé"
+repair = "Réparer"
+repaired = "{{name}} réparé"
+repairFailed = "Impossible de réparer {{name}}"
+
[database]
backupCreated = "Sauvegarde de la base de donnée réussie"
fileName = "Nom du Fichier"
@@ -14052,6 +14059,7 @@ closeAll = "Fermer tous les fichiers"
closePdf = "Fermer le PDF"
deselectAll = "Tout désélectionner"
downloadAll = "Tout télécharger"
+exitAnnotations = "Quitter le mode annotation"
exitRedaction = "Quitter le mode Rédaction"
formFill = "Éditeur de formulaires"
hideToolbar = "Masquer la barre d’outils"
diff --git a/frontend/editor/public/locales/ga-IE/translation.toml b/frontend/editor/public/locales/ga-IE/translation.toml
index dcb302fe8f..673ea6991a 100644
--- a/frontend/editor/public/locales/ga-IE/translation.toml
+++ b/frontend/editor/public/locales/ga-IE/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Úsáid ionchuir chomhordanáidí chun suíomh cruinn a shocrú"
resize = "Tarraing na hanlaí cúinne agus imeall chun méid a athrú"
title = "Conas PDFanna a Bhearradh"
+[damagedPdf]
+description = "Tá an PDF seo millte agus ní féidir é a oscailt."
+label = "Millte"
+repair = "Deisigh"
+repaired = "Deisíodh {{name}}"
+repairFailed = "Níorbh fhéidir {{name}} a dheisiú"
+
[database]
backupCreated = "D'éirigh le cúltaca bunachar sonraí"
fileName = "Ainm comhaid"
@@ -14052,6 +14059,7 @@ closeAll = "Dún gach comhad"
closePdf = "Dún PDF"
deselectAll = "Díroghnaigh uile"
downloadAll = "Íoslódáil gach comhad"
+exitAnnotations = "Scoir den mhód anótála"
exitRedaction = "Scoir de mhód ceilte"
formFill = "Eagarthóir Foirmeacha"
hideToolbar = "Folaigh barra uirlisí"
diff --git a/frontend/editor/public/locales/gl-ES/translation.toml b/frontend/editor/public/locales/gl-ES/translation.toml
index e122878c8b..98ad0baf5d 100644
--- a/frontend/editor/public/locales/gl-ES/translation.toml
+++ b/frontend/editor/public/locales/gl-ES/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Usa os campos de coordenadas para unha colocación precisa"
resize = "Arrastra os controis das esquinas e dos bordos para redimensionar"
title = "Como recortar PDF"
+[damagedPdf]
+description = "Este PDF está danado e non se pode abrir."
+label = "Danado"
+repair = "Reparar"
+repaired = "Reparouse {{name}}"
+repairFailed = "Non se puido reparar {{name}}"
+
[database]
backupCreated = "Copia de seguranza da base de datos feita correctamente"
fileName = "Nome do ficheiro"
@@ -14052,6 +14059,7 @@ closeAll = "Pechar todos os ficheiros"
closePdf = "Pechar PDF"
deselectAll = "Deseleccionar todo"
downloadAll = "Descargar todo"
+exitAnnotations = "Saír do modo de anotación"
exitRedaction = "Saír do modo de censura"
formFill = "Editor de formularios"
hideToolbar = "Agochar a barra de ferramentas"
diff --git a/frontend/editor/public/locales/hi-IN/translation.toml b/frontend/editor/public/locales/hi-IN/translation.toml
index 27583e2d7a..dc58289f1b 100644
--- a/frontend/editor/public/locales/hi-IN/translation.toml
+++ b/frontend/editor/public/locales/hi-IN/translation.toml
@@ -4285,6 +4285,13 @@ precision = "सटीक पोजिशनिंग के लिए निर
resize = "आकार बदलने के लिए कोनों और किनारों के हैंडल खींचें"
title = "PDF कैसे क्रॉप करें"
+[damagedPdf]
+description = "यह PDF क्षतिग्रस्त है और खोली नहीं जा सकती।"
+label = "क्षतिग्रस्त"
+repair = "मरम्मत करें"
+repaired = "{{name}} की मरम्मत हो गई"
+repairFailed = "{{name}} की मरम्मत नहीं की जा सकी"
+
[database]
backupCreated = "डेटाबेस बैकअप सफल"
fileName = "फ़ाइल नाम"
@@ -14052,6 +14059,7 @@ closeAll = "सभी फ़ाइलें बंद करें"
closePdf = "PDF बंद करें"
deselectAll = "सभी चयन हटाएँ"
downloadAll = "सभी डाउनलोड करें"
+exitAnnotations = "एनोटेशन मोड से बाहर निकलें"
exitRedaction = "रिडैक्शन मोड से बाहर निकलें"
formFill = "फ़ॉर्म एडिटर"
hideToolbar = "टूलबार छिपाएँ"
diff --git a/frontend/editor/public/locales/hr-HR/translation.toml b/frontend/editor/public/locales/hr-HR/translation.toml
index 9ee51fe3f0..aaf59dfc67 100644
--- a/frontend/editor/public/locales/hr-HR/translation.toml
+++ b/frontend/editor/public/locales/hr-HR/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Koristite unos koordinata za precizno pozicioniranje"
resize = "Povucite ručke na kutovima i rubovima za promjenu veličine"
title = "Kako izrezati PDF-ove"
+[damagedPdf]
+description = "Ovaj PDF je oštećen i ne može se otvoriti."
+label = "Oštećen"
+repair = "Popravi"
+repaired = "Popravljeno {{name}}"
+repairFailed = "Nije moguće popraviti {{name}}"
+
[database]
backupCreated = "Sigurnosna kopija baze podataka uspješno stvorena"
fileName = "Ime datoteke"
@@ -14052,6 +14059,7 @@ closeAll = "Zatvori sve datoteke"
closePdf = "Zatvori PDF"
deselectAll = "Poništi odabir svega"
downloadAll = "Preuzmi sve"
+exitAnnotations = "Izađi iz načina za bilješke"
exitRedaction = "Izađi iz načina zatamnjivanja"
formFill = "Uređivač obrazaca"
hideToolbar = "Sakrij alatnu traku"
diff --git a/frontend/editor/public/locales/hu-HU/translation.toml b/frontend/editor/public/locales/hu-HU/translation.toml
index ae9b77de60..a16d64ce0a 100644
--- a/frontend/editor/public/locales/hu-HU/translation.toml
+++ b/frontend/editor/public/locales/hu-HU/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Használja a koordinátamezőket a pontos pozicionáláshoz"
resize = "Húzza a sarkok és élek fogópontjait az átméretezéshez"
title = "Hogyan vágjon PDF-et"
+[damagedPdf]
+description = "Ez a PDF sérült, és nem nyitható meg."
+label = "Sérült"
+repair = "Javítás"
+repaired = "Javítva: {{name}}"
+repairFailed = "Nem sikerült javítani: {{name}}"
+
[database]
backupCreated = "Adatbázis biztonsági mentése sikeres"
fileName = "Fájlnév"
@@ -14052,6 +14059,7 @@ closeAll = "Összes fájl bezárása"
closePdf = "PDF bezárása"
deselectAll = "Összes kijelölés megszüntetése"
downloadAll = "Összes letöltése"
+exitAnnotations = "Kilépés az annotációs módból"
exitRedaction = "Kilépés a kitakarási módból"
formFill = "Űrlapszerkesztő"
hideToolbar = "Eszköztár elrejtése"
diff --git a/frontend/editor/public/locales/id-ID/translation.toml b/frontend/editor/public/locales/id-ID/translation.toml
index e730e00b69..02b47abca6 100644
--- a/frontend/editor/public/locales/id-ID/translation.toml
+++ b/frontend/editor/public/locales/id-ID/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Gunakan input koordinat untuk penempatan yang presisi"
resize = "Seret gagang sudut dan tepi untuk mengubah ukuran"
title = "Cara Memangkas PDF"
+[damagedPdf]
+description = "PDF ini rusak dan tidak dapat dibuka."
+label = "Rusak"
+repair = "Perbaiki"
+repaired = "{{name}} telah diperbaiki"
+repairFailed = "Tidak dapat memperbaiki {{name}}"
+
[database]
backupCreated = "Cadangan database berhasil"
fileName = "Nama Berkas"
@@ -14052,6 +14059,7 @@ closeAll = "Tutup semua file"
closePdf = "Tutup PDF"
deselectAll = "Batalkan semua pilihan"
downloadAll = "Unduh Semua"
+exitAnnotations = "Keluar dari mode anotasi"
exitRedaction = "Keluar dari Mode Redaksi"
formFill = "Editor Formulir"
hideToolbar = "Sembunyikan bilah alat"
diff --git a/frontend/editor/public/locales/it-IT/translation.toml b/frontend/editor/public/locales/it-IT/translation.toml
index a51d90ddcc..e50b5fda7e 100644
--- a/frontend/editor/public/locales/it-IT/translation.toml
+++ b/frontend/editor/public/locales/it-IT/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Usa gli input delle coordinate per un posizionamento preciso"
resize = "Trascina i bordi e gli angoli per ridimensionare"
title = "Come ritagliare i PDF"
+[damagedPdf]
+description = "Questo PDF è danneggiato e non può essere aperto."
+label = "Danneggiato"
+repair = "Ripara"
+repaired = "Riparato {{name}}"
+repairFailed = "Impossibile riparare {{name}}"
+
[database]
backupCreated = "Backup del database riuscito"
fileName = "Nome file"
@@ -14052,6 +14059,7 @@ closeAll = "Chiudi tutti i file"
closePdf = "Chiudi PDF"
deselectAll = "Deseleziona tutto"
downloadAll = "Scarica tutto"
+exitAnnotations = "Esci dalla modalità di annotazione"
exitRedaction = "Esci dalla modalità di oscuramento"
formFill = "Editor moduli"
hideToolbar = "Nascondi barra degli strumenti"
diff --git a/frontend/editor/public/locales/ja-JP/translation.toml b/frontend/editor/public/locales/ja-JP/translation.toml
index 83928475ee..1d7359f504 100644
--- a/frontend/editor/public/locales/ja-JP/translation.toml
+++ b/frontend/editor/public/locales/ja-JP/translation.toml
@@ -4285,6 +4285,13 @@ precision = "座標入力で正確に位置指定"
resize = "角と辺のハンドルをドラッグしてサイズ変更"
title = "PDF を切り抜く方法"
+[damagedPdf]
+description = "この PDF は破損しているため、開けません。"
+label = "破損"
+repair = "修復"
+repaired = "{{name}} を修復しました"
+repairFailed = "{{name}} を修復できませんでした"
+
[database]
backupCreated = "データベースのバックアップに成功しました"
fileName = "ファイル名"
@@ -14052,6 +14059,7 @@ closeAll = "すべてのファイルを閉じる"
closePdf = "PDF を閉じる"
deselectAll = "すべての選択を解除"
downloadAll = "すべてダウンロード"
+exitAnnotations = "注釈モードを終了"
exitRedaction = "墨消しモードを終了"
formFill = "フォームエディター"
hideToolbar = "ツールバーを非表示"
diff --git a/frontend/editor/public/locales/ko-KR/translation.toml b/frontend/editor/public/locales/ko-KR/translation.toml
index 9b884de376..af937f14c7 100644
--- a/frontend/editor/public/locales/ko-KR/translation.toml
+++ b/frontend/editor/public/locales/ko-KR/translation.toml
@@ -4285,6 +4285,13 @@ precision = "정확한 위치 지정을 위해 좌표 입력 사용"
resize = "모서리 및 가장자리 핸들을 드래그하여 크기 조절"
title = "PDF 자르는 방법"
+[damagedPdf]
+description = "이 PDF는 손상되어 열 수 없습니다."
+label = "손상됨"
+repair = "복구"
+repaired = "{{name}} 복구됨"
+repairFailed = "{{name}} 복구 실패"
+
[database]
backupCreated = "데이터베이스 백업 성공"
fileName = "파일 이름"
@@ -14052,6 +14059,7 @@ closeAll = "모든 파일 닫기"
closePdf = "PDF 닫기"
deselectAll = "모두 선택 해제"
downloadAll = "모두 다운로드"
+exitAnnotations = "주석 모드 종료"
exitRedaction = "가리기 모드 종료"
formFill = "양식 편집기"
hideToolbar = "도구 모음 숨기기"
diff --git a/frontend/editor/public/locales/ml-ML/translation.toml b/frontend/editor/public/locales/ml-ML/translation.toml
index c199301476..d502e5061a 100644
--- a/frontend/editor/public/locales/ml-ML/translation.toml
+++ b/frontend/editor/public/locales/ml-ML/translation.toml
@@ -4285,6 +4285,13 @@ precision = "തികച്ചും കൃത്യമായ സ്ഥാന
resize = "കോണുകളിലെയും അരികുകളിലെയും ഹാൻഡിലുകൾ ഡ്രാഗ് ചെയ്ത് വലിപ്പം മാറ്റുക"
title = "PDFകൾ എങ്ങനെ ക്രോപ്പ് ചെയ്യാം"
+[damagedPdf]
+description = "ഈ PDF കേടായതിനാൽ തുറക്കാനാവില്ല."
+label = "കേടായത്"
+repair = "നന്നാക്കുക"
+repaired = "{{name}} നന്നാക്കി"
+repairFailed = "{{name}} നന്നാക്കാനായില്ല"
+
[database]
backupCreated = "ഡാറ്റാബേസ് ബാക്കപ്പ് വിജയകരം"
fileName = "ഫയലിന്റെ പേര്"
@@ -14052,6 +14059,7 @@ closeAll = "എല്ലാ ഫയലുകളും അടയ്ക്കുക
closePdf = "PDF അടയ്ക്കുക"
deselectAll = "എല്ലാം തിരഞ്ഞെടുക്കൽ ഒഴിവാക്കുക"
downloadAll = "എല്ലാം ഡൗൺലോഡ് ചെയ്യുക"
+exitAnnotations = "അനോട്ടേഷൻ മോഡിൽ നിന്ന് പുറത്തുകടക്കുക"
exitRedaction = "റെഡാക്ഷൻ മോഡിൽ നിന്ന് പുറത്തിറങ്ങുക"
formFill = "ഫോം എഡിറ്റർ"
hideToolbar = "toolbar മറയ്ക്കുക"
diff --git a/frontend/editor/public/locales/nl-NL/translation.toml b/frontend/editor/public/locales/nl-NL/translation.toml
index 84b82ef205..22ce178a90 100644
--- a/frontend/editor/public/locales/nl-NL/translation.toml
+++ b/frontend/editor/public/locales/nl-NL/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Gebruik coördinatenvelden voor nauwkeurige positionering"
resize = "Sleep aan de hoek- en randgrepen om te schalen"
title = "PDF's bijsnijden"
+[damagedPdf]
+description = "Deze PDF is beschadigd en kan niet worden geopend."
+label = "Beschadigd"
+repair = "Repareren"
+repaired = "Gerepareerd {{name}}"
+repairFailed = "Kan {{name}} niet repareren"
+
[database]
backupCreated = "Databaseback-up geslaagd"
fileName = "Bestandsnaam"
@@ -14052,6 +14059,7 @@ closeAll = "Alle bestanden sluiten"
closePdf = "PDF sluiten"
deselectAll = "Alles deselecteren"
downloadAll = "Alles downloaden"
+exitAnnotations = "Annotatiemodus verlaten"
exitRedaction = "Zwartlakmodus afsluiten"
formFill = "Formuliereditor"
hideToolbar = "Toolbar verbergen"
diff --git a/frontend/editor/public/locales/no-NB/translation.toml b/frontend/editor/public/locales/no-NB/translation.toml
index d0cf8cebc7..c12c541651 100644
--- a/frontend/editor/public/locales/no-NB/translation.toml
+++ b/frontend/editor/public/locales/no-NB/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Bruk koordinatinndata for presis posisjonering"
resize = "Dra i hjørne- og kantgrep for å endre størrelse"
title = "Slik beskjærer du PDF-er"
+[damagedPdf]
+description = "Denne PDF-en er skadet og kan ikke åpnes."
+label = "Skadet"
+repair = "Reparer"
+repaired = "Reparert {{name}}"
+repairFailed = "Kunne ikke reparere {{name}}"
+
[database]
backupCreated = "Sikkerhetskopiering opprettet"
fileName = "Fil navn"
@@ -14052,6 +14059,7 @@ closeAll = "Lukk alle filer"
closePdf = "Lukk PDF"
deselectAll = "Opphev valg av alle"
downloadAll = "Last ned alt"
+exitAnnotations = "Avslutt annoteringsmodus"
exitRedaction = "Avslutt sladdemodus"
formFill = "Skjemaredigerer"
hideToolbar = "Skjul verktøylinje"
diff --git a/frontend/editor/public/locales/pl-PL/translation.toml b/frontend/editor/public/locales/pl-PL/translation.toml
index aea8ea4c93..7718ec2cf1 100644
--- a/frontend/editor/public/locales/pl-PL/translation.toml
+++ b/frontend/editor/public/locales/pl-PL/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Użyj pól współrzędnych dla precyzyjnego pozycjonowania"
resize = "Przeciągnij uchwyty w rogach i na krawędziach, aby zmienić rozmiar"
title = "Jak przycinać PDF-y"
+[damagedPdf]
+description = "Ten PDF jest uszkodzony i nie można go otworzyć."
+label = "Uszkodzony"
+repair = "Napraw"
+repaired = "Naprawiono {{name}}"
+repairFailed = "Nie udało się naprawić {{name}}"
+
[database]
backupCreated = "Kopia zapasowa bazy danych została utworzona pomyślnie"
fileName = "Nazwa pliku"
@@ -14052,6 +14059,7 @@ closeAll = "Zamknij wszystkie pliki"
closePdf = "Zamknij PDF"
deselectAll = "Odznacz wszystko"
downloadAll = "Pobierz wszystko"
+exitAnnotations = "Wyjdź z trybu adnotacji"
exitRedaction = "Zakończ tryb zaczerniania"
formFill = "Edytor formularzy"
hideToolbar = "Ukryj pasek narzędzi"
diff --git a/frontend/editor/public/locales/pt-BR/translation.toml b/frontend/editor/public/locales/pt-BR/translation.toml
index d707350d65..f0fc43f8c3 100644
--- a/frontend/editor/public/locales/pt-BR/translation.toml
+++ b/frontend/editor/public/locales/pt-BR/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Use as entradas de coordenadas para posicionamento preciso"
resize = "Arraste os cantos e bordas para redimensionar"
title = "Como recortar PDFs"
+[damagedPdf]
+description = "Este PDF está danificado e não pode ser aberto."
+label = "Danificado"
+repair = "Reparar"
+repaired = "{{name}} reparado"
+repairFailed = "Não foi possível reparar {{name}}"
+
[database]
backupCreated = "Backup do banco de dados criado com sucesso"
fileName = "Nome do Arquivo"
@@ -14052,6 +14059,7 @@ closeAll = "Fechar todos os arquivos"
closePdf = "Fechar PDF"
deselectAll = "Desmarcar tudo"
downloadAll = "Baixar tudo"
+exitAnnotations = "Sair do modo de anotação"
exitRedaction = "Sair do modo de redação"
formFill = "Editor de formulários"
hideToolbar = "Ocultar barra de ferramentas"
diff --git a/frontend/editor/public/locales/pt-PT/translation.toml b/frontend/editor/public/locales/pt-PT/translation.toml
index 56cf189edb..a0ee4bdd45 100644
--- a/frontend/editor/public/locales/pt-PT/translation.toml
+++ b/frontend/editor/public/locales/pt-PT/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Use entradas de coordenadas para posicionamento preciso"
resize = "Arraste os manípulos dos cantos e das bordas para redimensionar"
title = "Como recortar PDFs"
+[damagedPdf]
+description = "Este PDF está danificado e não pode ser aberto."
+label = "Danificado"
+repair = "Reparar"
+repaired = "Reparado {{name}}"
+repairFailed = "Não foi possível reparar {{name}}"
+
[database]
backupCreated = "Backup da base de dados bem sucedido"
fileName = "Nome do Ficheiro"
@@ -14052,6 +14059,7 @@ closeAll = "Fechar todos os ficheiros"
closePdf = "Fechar PDF"
deselectAll = "Desselecionar tudo"
downloadAll = "Transferir tudo"
+exitAnnotations = "Sair do modo de anotação"
exitRedaction = "Sair do modo de expurgo"
formFill = "Editor de formulários"
hideToolbar = "Ocultar barra de ferramentas"
diff --git a/frontend/editor/public/locales/ro-RO/translation.toml b/frontend/editor/public/locales/ro-RO/translation.toml
index 5fc6d3b577..040173d2f8 100644
--- a/frontend/editor/public/locales/ro-RO/translation.toml
+++ b/frontend/editor/public/locales/ro-RO/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Folosiți câmpurile de coordonate pentru poziționare precisă"
resize = "Trageți de colțuri și margini pentru redimensionare"
title = "Cum să decupați PDF-uri"
+[damagedPdf]
+description = "Acest PDF este deteriorat și nu poate fi deschis."
+label = "Deteriorat"
+repair = "Repară"
+repaired = "Reparat {{name}}"
+repairFailed = "Nu s-a putut repara {{name}}"
+
[database]
backupCreated = "Copierea de rezervă a bazei de date a reușit"
fileName = "Nume Fișier"
@@ -14052,6 +14059,7 @@ closeAll = "Închide toate fișierele"
closePdf = "Închide PDF"
deselectAll = "Deselectează tot"
downloadAll = "Descarcă tot"
+exitAnnotations = "Ieși din modul de adnotare"
exitRedaction = "Ieși din modul de redactare"
formFill = "Editor de formulare"
hideToolbar = "Ascunde bara de instrumente"
diff --git a/frontend/editor/public/locales/ru-RU/translation.toml b/frontend/editor/public/locales/ru-RU/translation.toml
index 4294f51911..6806457a6e 100644
--- a/frontend/editor/public/locales/ru-RU/translation.toml
+++ b/frontend/editor/public/locales/ru-RU/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Используйте координаты для точного
resize = "Тяните за углы и края, чтобы изменить размер"
title = "Как обрезать PDF"
+[damagedPdf]
+description = "Этот PDF поврежден и не может быть открыт."
+label = "Поврежден"
+repair = "Восстановить"
+repaired = "Восстановлено: {{name}}"
+repairFailed = "Не удалось восстановить {{name}}"
+
[database]
backupCreated = "Резервное копирование базы данных выполнено успешно"
fileName = "Имя файла"
@@ -14052,6 +14059,7 @@ closeAll = "Закрыть все файлы"
closePdf = "Закрыть PDF"
deselectAll = "Снять выделение"
downloadAll = "Скачать все"
+exitAnnotations = "Выйти из режима аннотаций"
exitRedaction = "Выйти из режима скрытия данных"
formFill = "Редактор форм"
hideToolbar = "Скрыть панель инструментов"
diff --git a/frontend/editor/public/locales/sk-SK/translation.toml b/frontend/editor/public/locales/sk-SK/translation.toml
index 18c59aaa39..e80889c515 100644
--- a/frontend/editor/public/locales/sk-SK/translation.toml
+++ b/frontend/editor/public/locales/sk-SK/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Použite zadávanie súradníc pre presné umiestnenie"
resize = "Potiahnite rohové a bočné úchyty na zmenu veľkosti"
title = "Ako orezať PDF"
+[damagedPdf]
+description = "Tento PDF je poškodený a nedá sa otvoriť."
+label = "Poškodený"
+repair = "Opraviť"
+repaired = "Opravené {{name}}"
+repairFailed = "Nepodarilo sa opraviť {{name}}"
+
[database]
backupCreated = "Záloha databázy úspešná"
fileName = "Názov súboru"
@@ -14052,6 +14059,7 @@ closeAll = "Zavrieť všetky súbory"
closePdf = "Zavrieť PDF"
deselectAll = "Zrušiť výber všetkých"
downloadAll = "Stiahnuť všetko"
+exitAnnotations = "Ukončiť režim anotácií"
exitRedaction = "Ukončiť režim začiernenia"
formFill = "Editor formulárov"
hideToolbar = "Skryť panel nástrojov"
diff --git a/frontend/editor/public/locales/sl-SI/translation.toml b/frontend/editor/public/locales/sl-SI/translation.toml
index 429dc0fe38..1faac7e00c 100644
--- a/frontend/editor/public/locales/sl-SI/translation.toml
+++ b/frontend/editor/public/locales/sl-SI/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Za natančen položaj uporabite vnose koordinat"
resize = "Povlecite ročaje v kotih in na robovih za spremembo velikosti"
title = "Kako obrezati PDF-je"
+[damagedPdf]
+description = "Ta PDF je poškodovan in ga ni mogoče odpreti."
+label = "Poškodovan"
+repair = "Popravi"
+repaired = "Popravljeno {{name}}"
+repairFailed = "Ni bilo mogoče popraviti {{name}}"
+
[database]
backupCreated = "Uspešno varnostno kopiranje baze podatkov"
fileName = "Ime datoteke"
@@ -14052,6 +14059,7 @@ closeAll = "Zapri vse datoteke"
closePdf = "Zapri PDF"
deselectAll = "Prekliči izbor vseh"
downloadAll = "Prenesi vse"
+exitAnnotations = "Zapusti način opomb"
exitRedaction = "Izhod iz načina redakcije"
formFill = "Urejevalnik obrazcev"
hideToolbar = "Skrij orodno vrstico"
diff --git a/frontend/editor/public/locales/sr-Latn-RS/translation.toml b/frontend/editor/public/locales/sr-Latn-RS/translation.toml
index 243dae228e..a17c91a50c 100644
--- a/frontend/editor/public/locales/sr-Latn-RS/translation.toml
+++ b/frontend/editor/public/locales/sr-Latn-RS/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Koristite unos koordinata za precizno pozicioniranje"
resize = "Prevucite hvatišta na uglovima i ivicama da biste promenili veličinu"
title = "Kako iseći PDF-ove"
+[damagedPdf]
+description = "Ovaj PDF je oštećen i ne može da se otvori."
+label = "Oštećen"
+repair = "Popravi"
+repaired = "Popravljen {{name}}"
+repairFailed = "Nije moguće popraviti {{name}}"
+
[database]
backupCreated = "Rezervna kopija baze podataka je uspešna napravljena"
fileName = "Ime datoteke"
@@ -14052,6 +14059,7 @@ closeAll = "Zatvori sve datoteke"
closePdf = "Zatvori PDF"
deselectAll = "Poništi sav izbor"
downloadAll = "Preuzmi sve"
+exitAnnotations = "Izađi iz režima anotacija"
exitRedaction = "Izađi iz režima zacrnjivanja"
formFill = "Popuni obrazac"
hideToolbar = "Sakrij traku sa alatkama"
diff --git a/frontend/editor/public/locales/sv-SE/translation.toml b/frontend/editor/public/locales/sv-SE/translation.toml
index 4afa9bde03..74b974565b 100644
--- a/frontend/editor/public/locales/sv-SE/translation.toml
+++ b/frontend/editor/public/locales/sv-SE/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Använd koordinatfälten för exakt positionering"
resize = "Dra i hörn- och kantgreppen för att ändra storlek"
title = "Så beskär du PDF:er"
+[damagedPdf]
+description = "Den här PDF-filen är skadad och kan inte öppnas."
+label = "Skadad"
+repair = "Reparera"
+repaired = "Reparerade {{name}}"
+repairFailed = "Kunde inte reparera {{name}}"
+
[database]
backupCreated = "Backup av databas lyckades"
fileName = "Filnamn"
@@ -14052,6 +14059,7 @@ closeAll = "Stäng alla filer"
closePdf = "Stäng PDF"
deselectAll = "Avmarkera alla"
downloadAll = "Ladda ner alla"
+exitAnnotations = "Avsluta annoteringsläge"
exitRedaction = "Avsluta maskeringsläge"
formFill = "Formulärredigerare"
hideToolbar = "Dölj verktygsfält"
diff --git a/frontend/editor/public/locales/th-TH/translation.toml b/frontend/editor/public/locales/th-TH/translation.toml
index 9fbbebca69..490ae5ac17 100644
--- a/frontend/editor/public/locales/th-TH/translation.toml
+++ b/frontend/editor/public/locales/th-TH/translation.toml
@@ -4285,6 +4285,13 @@ precision = "ใช้ช่องกรอกพิกัดเพื่อค
resize = "ลากจุดจับที่มุมและขอบเพื่อปรับขนาด"
title = "วิธีครอบตัด PDF"
+[damagedPdf]
+description = "PDF นี้เสียหายและไม่สามารถเปิดได้"
+label = "เสียหาย"
+repair = "ซ่อมแซม"
+repaired = "ซ่อมแซม {{name}} แล้ว"
+repairFailed = "ไม่สามารถซ่อมแซม {{name}} ได้"
+
[database]
backupCreated = "สำรองฐานข้อมูลสำเร็จ"
fileName = "ชื่อไฟล์"
@@ -14052,6 +14059,7 @@ closeAll = "ปิดไฟล์ทั้งหมด"
closePdf = "ปิด PDF"
deselectAll = "ยกเลิกการเลือกทั้งหมด"
downloadAll = "ดาวน์โหลดทั้งหมด"
+exitAnnotations = "ออกจากโหมดคำอธิบายประกอบ"
exitRedaction = "ออกจากโหมดปกปิดข้อมูล"
formFill = "ตัวแก้ไขฟอร์ม"
hideToolbar = "ซ่อนแถบเครื่องมือ"
diff --git a/frontend/editor/public/locales/tr-TR/translation.toml b/frontend/editor/public/locales/tr-TR/translation.toml
index 193927dbd1..0222d76a2e 100644
--- a/frontend/editor/public/locales/tr-TR/translation.toml
+++ b/frontend/editor/public/locales/tr-TR/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Hassas konumlandırma için koordinat girişlerini kullanın"
resize = "Yeniden boyutlandırmak için köşe ve kenar tutamaçlarını sürükleyin"
title = "PDF'ler Nasıl Kırpılır"
+[damagedPdf]
+description = "Bu PDF hasarlı ve açılamıyor."
+label = "Hasarlı"
+repair = "Onar"
+repaired = "{{name}} onarıldı"
+repairFailed = "{{name}} onarılamadı"
+
[database]
backupCreated = "Veritabanı yedeklemesi başarılı"
fileName = "Dosya Adı"
@@ -14052,6 +14059,7 @@ closeAll = "Tüm dosyaları kapat"
closePdf = "PDF'yi kapat"
deselectAll = "Tümünün seçimini kaldır"
downloadAll = "Tümünü indir"
+exitAnnotations = "Açıklama modundan çık"
exitRedaction = "Karartma modundan çık"
formFill = "Form Düzenleyici"
hideToolbar = "Araç çubuğunu gizle"
diff --git a/frontend/editor/public/locales/uk-UA/translation.toml b/frontend/editor/public/locales/uk-UA/translation.toml
index 6f5d9ddcbf..ea7274193c 100644
--- a/frontend/editor/public/locales/uk-UA/translation.toml
+++ b/frontend/editor/public/locales/uk-UA/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Використовуйте поля координат для т
resize = "Перетягніть маркери кутів і країв, щоб змінити розмір"
title = "Як обрізати PDF"
+[damagedPdf]
+description = "Цей PDF пошкоджено, і його неможливо відкрити."
+label = "Пошкоджено"
+repair = "Відновити"
+repaired = "Відновлено {{name}}"
+repairFailed = "Не вдалося відновити {{name}}"
+
[database]
backupCreated = "Резервне копіювання бази даних успішно"
fileName = "Ім'я файлу"
@@ -14052,6 +14059,7 @@ closeAll = "Закрити всі файли"
closePdf = "Закрити PDF"
deselectAll = "Скасувати вибір"
downloadAll = "Завантажити всі"
+exitAnnotations = "Вийти з режиму анотацій"
exitRedaction = "Вийти з режиму затемнення"
formFill = "Редактор форм"
hideToolbar = "Сховати панель інструментів"
diff --git a/frontend/editor/public/locales/vi-VN/translation.toml b/frontend/editor/public/locales/vi-VN/translation.toml
index 1348d69b2f..d100d077c9 100644
--- a/frontend/editor/public/locales/vi-VN/translation.toml
+++ b/frontend/editor/public/locales/vi-VN/translation.toml
@@ -4285,6 +4285,13 @@ precision = "Dùng các ô tọa độ để định vị chính xác"
resize = "Kéo các chốt ở góc và cạnh để thay đổi kích thước"
title = "Cách cắt PDF"
+[damagedPdf]
+description = "PDF này bị hỏng và không thể mở được."
+label = "Bị hỏng"
+repair = "Sửa chữa"
+repaired = "Đã sửa chữa {{name}}"
+repairFailed = "Không thể sửa chữa {{name}}"
+
[database]
backupCreated = "Sao lưu cơ sở dữ liệu thành công"
fileName = "Tên tệp"
@@ -14052,6 +14059,7 @@ closeAll = "Đóng tất cả tệp"
closePdf = "Đóng PDF"
deselectAll = "Bỏ chọn tất cả"
downloadAll = "Tải xuống tất cả"
+exitAnnotations = "Thoát chế độ chú thích"
exitRedaction = "Thoát chế độ bôi đen"
formFill = "Trình chỉnh sửa biểu mẫu"
hideToolbar = "Ẩn thanh công cụ"
diff --git a/frontend/editor/public/locales/zh-BO/translation.toml b/frontend/editor/public/locales/zh-BO/translation.toml
index 5e58387718..3e3fc2784c 100644
--- a/frontend/editor/public/locales/zh-BO/translation.toml
+++ b/frontend/editor/public/locales/zh-BO/translation.toml
@@ -4285,6 +4285,13 @@ precision = "使用坐标输入以获得精确定位"
resize = "拖动角和边的控件来调整大小"
title = "如何裁剪 PDF"
+[damagedPdf]
+description = "此 PDF 已损坏,无法打开。"
+label = "已损坏"
+repair = "修复"
+repaired = "已修复 {{name}}"
+repairFailed = "无法修复 {{name}}"
+
[database]
backupCreated = "གཞི་གྲངས་མཛོད་གྲབས་ཉར་ལེགས་གྲུབ།"
fileName = "ཡིག་ཆའི་མིང་།"
@@ -14052,6 +14059,7 @@ closeAll = "关闭所有文件"
closePdf = "关闭 PDF"
deselectAll = "取消全选"
downloadAll = "全部下载"
+exitAnnotations = "退出批注模式"
exitRedaction = "退出涂黑模式"
formFill = "表单编辑器"
hideToolbar = "隐藏工具栏"
diff --git a/frontend/editor/public/locales/zh-CN/translation.toml b/frontend/editor/public/locales/zh-CN/translation.toml
index c9188e1759..3f495a5eea 100644
--- a/frontend/editor/public/locales/zh-CN/translation.toml
+++ b/frontend/editor/public/locales/zh-CN/translation.toml
@@ -4285,6 +4285,13 @@ precision = "使用坐标输入以获得精确位置"
resize = "拖动角与边的手柄来调整大小"
title = "如何裁剪 PDF"
+[damagedPdf]
+description = "此 PDF 已损坏,无法打开。"
+label = "已损坏"
+repair = "修复"
+repaired = "已修复 {{name}}"
+repairFailed = "无法修复 {{name}}"
+
[database]
backupCreated = "数据库备份成功"
fileName = "文件名"
@@ -14052,6 +14059,7 @@ closeAll = "关闭所有文件"
closePdf = "关闭 PDF"
deselectAll = "取消全选"
downloadAll = "全部下载"
+exitAnnotations = "退出批注模式"
exitRedaction = "退出涂黑模式"
formFill = "表单编辑器"
hideToolbar = "隐藏工具栏"
diff --git a/frontend/editor/public/locales/zh-TW/translation.toml b/frontend/editor/public/locales/zh-TW/translation.toml
index df06f534a1..c98add16cd 100644
--- a/frontend/editor/public/locales/zh-TW/translation.toml
+++ b/frontend/editor/public/locales/zh-TW/translation.toml
@@ -4285,6 +4285,13 @@ precision = "使用座標輸入可精準定位"
resize = "拖曳角落與邊緣手把以調整大小"
title = "如何裁切 PDF"
+[damagedPdf]
+description = "此 PDF 已損毀,無法開啟。"
+label = "已損毀"
+repair = "修復"
+repaired = "已修復 {{name}}"
+repairFailed = "無法修復 {{name}}"
+
[database]
backupCreated = "資料庫備份成功"
fileName = "檔案名稱"
@@ -14052,6 +14059,7 @@ closeAll = "關閉所有檔案"
closePdf = "關閉 PDF"
deselectAll = "取消全選"
downloadAll = "下載全部"
+exitAnnotations = "離開註解模式"
exitRedaction = "離開遮蔽模式"
formFill = "表單編輯器"
hideToolbar = "隱藏工具列"
diff --git a/frontend/editor/src/core/components/AppProviders.tsx b/frontend/editor/src/core/components/AppProviders.tsx
index e27fb679b6..07b39cb88b 100644
--- a/frontend/editor/src/core/components/AppProviders.tsx
+++ b/frontend/editor/src/core/components/AppProviders.tsx
@@ -7,6 +7,7 @@ import { NavigationProvider } from "@app/contexts/NavigationContext";
import { ToolRegistryProvider } from "@app/contexts/ToolRegistryProvider";
import { FilesModalProvider } from "@app/contexts/FilesModalContext";
import { ToolWorkflowProvider } from "@app/contexts/ToolWorkflowContext";
+import { DamagedFileRepairProvider } from "@app/contexts/DamagedFileRepairContext";
import { HotkeyProvider } from "@app/contexts/HotkeyContext";
import { SidebarProvider } from "@app/contexts/SidebarContext";
import {
@@ -169,7 +170,9 @@ export function AppProviders({
<TourOrchestrationProvider>
<AdminTourOrchestrationProvider>
<WorkbenchSessionPersistence />
- {children}
+ <DamagedFileRepairProvider>
+ {children}
+ </DamagedFileRepairProvider>
</AdminTourOrchestrationProvider>
</TourOrchestrationProvider>
</WorkbenchBarProvider>
diff --git a/frontend/editor/src/core/components/fileEditor/FileEditorThumbnail.module.css b/frontend/editor/src/core/components/fileEditor/FileEditorThumbnail.module.css
index 8b5101a0fb..7888d2f4e9 100644
--- a/frontend/editor/src/core/components/fileEditor/FileEditorThumbnail.module.css
+++ b/frontend/editor/src/core/components/fileEditor/FileEditorThumbnail.module.css
@@ -207,6 +207,11 @@
pointer-events: none;
}
+/* The overlay ignores pointer events so clicks reach the card; Repair must not. */
+.damagedRepairButton {
+ pointer-events: auto;
+}
+
.errorPill {
background: var(--mantine-color-red-6);
color: var(--c-text-on-primary);
diff --git a/frontend/editor/src/core/components/fileEditor/FileEditorThumbnail.tsx b/frontend/editor/src/core/components/fileEditor/FileEditorThumbnail.tsx
index 4f4aa2e39b..2f58a21992 100644
--- a/frontend/editor/src/core/components/fileEditor/FileEditorThumbnail.tsx
+++ b/frontend/editor/src/core/components/fileEditor/FileEditorThumbnail.tsx
@@ -47,6 +47,7 @@ import { LARGE_PDF_PARSE_LIMIT } from "@app/utils/thumbnailUtils";
import { truncateCenter } from "@app/utils/textUtils";
import { FileEditorStatusDot } from "@app/components/fileEditor/FileEditorStatusDot";
import { useToolEligibleFileIds } from "@app/contexts/ToolFileEligibilityContext";
+import { useDamagedFileRepair } from "@app/contexts/DamagedFileRepairContext";
interface FileEditorThumbnailProps {
file: StirlingFileStub;
@@ -107,6 +108,10 @@ const FileEditorThumbnail = ({
const isZipFile = zipFileService.isZipFileStub(file);
const hasError = useFileSelector((s) => s.ui.errorFileIds.includes(file.id));
+ const isDamaged = file.processedFile?.isDamaged === true;
+ const damagedRepair = useDamagedFileRepair();
+ const isRepairing = damagedRepair?.repairingFileId === file.id;
+ const repairBusy = damagedRepair?.repairingFileId != null;
const pageCount = file.processedFile?.totalPages || 0;
const {
isEncrypted,
@@ -346,6 +351,20 @@ const FileEditorThumbnail = ({
onViewFile(file.id);
},
},
+ {
+ id: "repair",
+ icon: <Icon name="wrench" size={20} />,
+ label: t("damagedPdf.repair", "Repair"),
+ disabled: policyEnforcing || repairBusy,
+ tooltip: policyEnforcing
+ ? enforcingTooltip(t("damagedPdf.repair", "Repair"))
+ : undefined,
+ onClick: (e) => {
+ e.stopPropagation();
+ damagedRepair?.repair(file.id);
+ },
+ hidden: !isDamaged || !damagedRepair,
+ },
{
id: "pin",
icon: <Icon name="pin" size={20} filled={isPinned} />,
@@ -477,6 +496,9 @@ const FileEditorThumbnail = ({
isCBZ,
isCBR,
isPinned,
+ isDamaged,
+ damagedRepair,
+ repairBusy,
actualFile,
terminology,
onViewFile,
@@ -564,6 +586,40 @@ const FileEditorThumbnail = ({
</div>
)}
+ {isDamaged && !hasError && (
+ <div className={styles.errorOverlay}>
+ <Stack align="center" gap="xs">
+ <Tooltip
+ label={t(
+ "damagedPdf.description",
+ "This PDF is damaged and can't be opened.",
+ )}
+ withArrow
+ >
+ <span className={styles.errorPill}>
+ {t("damagedPdf.label", "Damaged")}
+ </span>
+ </Tooltip>
+ {damagedRepair && (
+ <Button
+ size="sm"
+ className={styles.damagedRepairButton}
+ loading={isRepairing}
+ disabled={
+ policyEnforcing || (repairBusy && !isRepairing)
+ }
+ onClick={(e) => {
+ e.stopPropagation();
+ damagedRepair.repair(file.id);
+ }}
+ >
+ {t("damagedPdf.repair", "Repair")}
+ </Button>
+ )}
+ </Stack>
+ </div>
+ )}
+
{/* Policy enforcement overlay — shown while any policy is in-flight */}
<PolicyEnforcingOverlay
enforcing={policyEnforcing && !enforcingDismissed}
@@ -580,6 +636,7 @@ const FileEditorThumbnail = ({
isEncrypted={isEncrypted}
isLoading={
!isEncrypted &&
+ !isDamaged &&
!displayThumbnail &&
// No thumbnail is ever produced at/above the parse limit, so
// without this the spinner has no terminal state.
diff --git a/frontend/editor/src/core/components/shared/FileSidebar.tsx b/frontend/editor/src/core/components/shared/FileSidebar.tsx
index 066fb3b84c..776508f31d 100644
--- a/frontend/editor/src/core/components/shared/FileSidebar.tsx
+++ b/frontend/editor/src/core/components/shared/FileSidebar.tsx
@@ -70,6 +70,7 @@ import { useFilesPage } from "@app/contexts/FilesPageContext";
import type { FolderId, FolderRecord } from "@app/types/folder";
import { useToolEligibleFileIds } from "@app/contexts/ToolFileEligibilityContext";
import { useWorkbenchFileDrop } from "@app/components/layout/useWorkbenchFileDrop";
+import { useDamagedFileRepair } from "@app/contexts/DamagedFileRepairContext";
import "@app/components/shared/FileSidebar.css";
// Shared with the processor sidebar via tokens, so the two cannot drift.
@@ -510,6 +511,7 @@ const FileSidebar = forwardRef<HTMLDivElement, FileSidebarProps>(
} = useGoogleDrivePicker();
const { state } = useFileState();
const { actions: fileActions } = useFileActions();
+ const damagedRepair = useDamagedFileRepair();
const { actions: navActions } = useNavigationActions();
const { workbench: currentWorkbench } = useNavigationState();
const policyFileBadges = usePolicyFileBadges();
@@ -1055,6 +1057,10 @@ const FileSidebar = forwardRef<HTMLDivElement, FileSidebarProps>(
const fileOrigin = getFileOrigin(stub);
const dataUnavailable =
stub.dataUnavailable === true || lostFileIds.has(stub.id);
+ // Damage is detected while hydrating, so only workbench files carry it.
+ const isDamaged = workbenchFileId
+ ? state.files.byId[workbenchFileId]?.processedFile?.isDamaged === true
+ : false;
// Lineage keys preserve rows across version changes; split siblings need unique leaf IDs.
const lineageKey = stub.originalFileId ?? stub.id;
const rowKey =
@@ -1081,6 +1087,8 @@ const FileSidebar = forwardRef<HTMLDivElement, FileSidebarProps>(
onClick={handleFileClick}
onEyeClick={handleEyeClick}
dataUnavailable={dataUnavailable}
+ isDamaged={isDamaged}
+ onRepair={damagedRepair?.repair}
policies={policyFileBadges.get(stub.id) ?? NO_POLICIES}
onDelete={handleSidebarDelete}
onDownload={handleDownload}
diff --git a/frontend/editor/src/core/components/shared/FileSidebarFileItem.tsx b/frontend/editor/src/core/components/shared/FileSidebarFileItem.tsx
index 95b1742c0a..32a479140e 100644
--- a/frontend/editor/src/core/components/shared/FileSidebarFileItem.tsx
+++ b/frontend/editor/src/core/components/shared/FileSidebarFileItem.tsx
@@ -151,6 +151,9 @@ export interface FileItemProps {
/** The stored bytes are gone (WebKit lost the blob's backing store). The row
* says so instead of pretending the file can open. */
dataUnavailable?: boolean;
+ /** The PDF could not be parsed; the row offers Repair instead. */
+ isDamaged?: boolean;
+ onRepair?: (fileId: FileId) => void;
}
/** One kebab row. `disabledReason`, when set, greys the row out and says why. */
@@ -205,6 +208,8 @@ export const FileItem = React.memo(function FileItem({
isViewedInViewer,
isToolSkipped = false,
dataUnavailable,
+ isDamaged = false,
+ onRepair,
thumbnailUrl,
isEncrypted,
onClick,
@@ -366,6 +371,21 @@ export const FileItem = React.memo(function FileItem({
</span>
</Tooltip>
)}
+ {isDamaged && !dataUnavailable && (
+ <Tooltip
+ label={t(
+ "damagedPdf.description",
+ "This PDF is damaged and can't be opened.",
+ )}
+ withArrow
+ position="top"
+ >
+ <span className="file-sidebar-datalost-badge" data-no-select>
+ <Icon name="circle-alert" size={"0.85rem"} />
+ {t("damagedPdf.label", "Damaged")}
+ </span>
+ </Tooltip>
+ )}
{isUploadedToCloud && (
<Tooltip
label={t(
@@ -452,6 +472,18 @@ export const FileItem = React.memo(function FileItem({
{viewerLabel}
</FileMenuItem>
+ {isDamaged && onRepair && (
+ <FileMenuItem
+ disabledReason={blockedReason(
+ t("damagedPdf.repair", "Repair"),
+ )}
+ icon={<Icon name="wrench" size={16} />}
+ onClick={() => onRepair(fileId)}
+ >
+ {t("damagedPdf.repair", "Repair")}
+ </FileMenuItem>
+ )}
+
{onOpenInNewWindow && (
<FileMenuItem
disabledReason={blockedReason(
diff --git a/frontend/editor/src/core/components/viewer/DocumentReadyWrapper.tsx b/frontend/editor/src/core/components/viewer/DocumentReadyWrapper.tsx
index cf6fac2abb..5b70a8891c 100644
--- a/frontend/editor/src/core/components/viewer/DocumentReadyWrapper.tsx
+++ b/frontend/editor/src/core/components/viewer/DocumentReadyWrapper.tsx
@@ -3,40 +3,60 @@ import {
useActiveDocument,
useDocumentManagerCapability,
} from "@embedpdf/plugin-document-manager/react";
-import { Center, Stack, Text } from "@mantine/core";
+import { Center, Group, Stack, Text } from "@mantine/core";
import { Button } from "@app/ui/Button";
import { useTranslation } from "react-i18next";
+import { isDamagedPdfError } from "@app/utils/pdfDamage";
interface DocumentReadyWrapperProps {
children: (documentId: string) => React.ReactNode;
fallback?: React.ReactNode;
+ /** Offered instead of a bare retry when the file itself cannot be parsed. */
+ onRepair?: () => void;
+ repairing?: boolean;
}
export function DocumentReadyWrapper({
children,
fallback = null,
+ onRepair,
+ repairing = false,
}: DocumentReadyWrapperProps) {
const { activeDocumentId, activeDocument } = useActiveDocument();
const { provides: manager } = useDocumentManagerCapability();
const { t } = useTranslation();
if (activeDocumentId && activeDocument?.status === "error") {
+ const damaged = isDamagedPdfError({ code: activeDocument.errorCode });
return (
<Center h="100%">
<Stack align="center">
<Text role="alert">
- {activeDocument.error ||
- t("viewer.error.loadError", "Failed to load PDF")}
+ {damaged
+ ? t(
+ "damagedPdf.description",
+ "This PDF is damaged and can't be opened.",
+ )
+ : activeDocument.error ||
+ t("viewer.error.loadError", "Failed to load PDF")}
</Text>
- <Button
- onClick={() => {
- void manager
- ?.retryDocument(activeDocumentId)
- .toPromise()
- .catch(() => {});
- }}
- >
- {t("common.retry", "Retry")}
- </Button>
+ <Group>
+ {damaged && onRepair && (
+ <Button onClick={onRepair} loading={repairing}>
+ {t("damagedPdf.repair", "Repair")}
+ </Button>
+ )}
+ <Button
+ variant={damaged && onRepair ? "secondary" : undefined}
+ onClick={() => {
+ void manager
+ ?.retryDocument(activeDocumentId)
+ .toPromise()
+ .catch(() => {});
+ }}
+ >
+ {t("common.retry", "Retry")}
+ </Button>
+ </Group>
</Stack>
</Center>
);
diff --git a/frontend/editor/src/core/components/viewer/EmbedPdfViewer.tsx b/frontend/editor/src/core/components/viewer/EmbedPdfViewer.tsx
index eb2642ecd9..1df98a3e89 100644
--- a/frontend/editor/src/core/components/viewer/EmbedPdfViewer.tsx
+++ b/frontend/editor/src/core/components/viewer/EmbedPdfViewer.tsx
@@ -74,6 +74,7 @@ import { useMeasurementManager } from "@app/hooks/useMeasurementManager";
import { ScaleCalibrationDialog } from "@app/components/viewer/ScaleCalibrationDialog";
import { usePolicyFileBadges } from "@app/hooks/usePolicyFileBadges";
import { alert } from "@app/components/toast";
+import { useDamagedFileRepair } from "@app/contexts/DamagedFileRepairContext";
// ──────────────────────────────────────────────────────────────────────────────
@@ -136,6 +137,7 @@ const EmbedPdfViewerContent = ({
onPasswordRequired,
}: EmbedPdfViewerProps & { onPasswordRequired?: () => void }) => {
const { t } = useTranslation();
+ const damagedRepair = useDamagedFileRepair();
const viewerRef = React.useRef<HTMLDivElement>(null);
const pdfContainerRef = useRef<HTMLDivElement>(null);
const [isViewerHovered, setIsViewerHovered] = React.useState(false);
@@ -1933,6 +1935,8 @@ const EmbedPdfViewerContent = ({
onDocumentReady={documentReady}
onDocumentLoadFailed={documentFailed}
onPasswordRequired={onPasswordRequired}
+ onRepair={previewFile ? undefined : damagedRepair?.repair}
+ repairingFileId={damagedRepair?.repairingFileId}
restorePending={restorePending}
restoreRequest={restoreRequest}
onRestoreEvent={handleRestoreEvent}
diff --git a/frontend/editor/src/core/components/viewer/LocalEmbedPDF.tsx b/frontend/editor/src/core/components/viewer/LocalEmbedPDF.tsx
index a5ed3a7e74..da30acc4d5 100644
--- a/frontend/editor/src/core/components/viewer/LocalEmbedPDF.tsx
+++ b/frontend/editor/src/core/components/viewer/LocalEmbedPDF.tsx
@@ -109,6 +109,7 @@ import { AnnotationMenuEvents } from "@app/components/viewer/AnnotationMenuEvent
import { DocumentSwapBridge } from "@app/components/viewer/DocumentSwapBridge";
import { PdfPasswordBridge } from "@app/components/viewer/PdfPasswordBridge";
import { isStirlingFile } from "@app/types/fileContext";
+import type { FileId } from "@app/types/file";
import { pdfAllows, canPrintPdf } from "@app/services/pdfPermissions";
import { PdfPermissionFlag } from "@embedpdf/models";
@@ -198,6 +199,9 @@ interface LocalEmbedPDFProps {
/** Includes byte-read failures, engine errors and cancelled loads. */
onDocumentLoadFailed?: (fileKey: string, error: unknown) => void;
onPasswordRequired?: () => void;
+ /** Offered on the error screen when PDFium cannot parse the open file. */
+ onRepair?: (fileId: FileId) => void;
+ repairingFileId?: FileId | null;
/** True while a view restore is in flight; gates the per-page layout hook. */
restorePending?: boolean;
restoreRequest?: DocumentRestoreRequest | null;
@@ -923,6 +927,8 @@ export function LocalEmbedPDF({
onDocumentReady,
onDocumentLoadFailed,
onPasswordRequired,
+ onRepair,
+ repairingFileId,
restorePending = false,
restoreRequest = null,
onRestoreEvent,
@@ -1728,6 +1734,14 @@ export function LocalEmbedPDF({
permissions={pdfAccess?.permissions ?? 0}
/>
<DocumentReadyWrapper
+ onRepair={
+ onRepair && file && isStirlingFile(file)
+ ? () => onRepair(file.fileId)
+ : undefined
+ }
+ repairing={
+ !!file && isStirlingFile(file) && repairingFileId === file.fileId
+ }
fallback={
<Center style={{ height: "100%", width: "100%" }}>
<ToolLoadingFallback />
diff --git a/frontend/editor/src/core/contexts/DamagedFileRepairContext.tsx b/frontend/editor/src/core/contexts/DamagedFileRepairContext.tsx
new file mode 100644
index 0000000000..2e33585952
--- /dev/null
+++ b/frontend/editor/src/core/contexts/DamagedFileRepairContext.tsx
@@ -0,0 +1,113 @@
+import {
+ createContext,
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+ type ReactNode,
+} from "react";
+import { useTranslation } from "react-i18next";
+import { useRepairOperation } from "@app/hooks/tools/repair/useRepairOperation";
+import { defaultParameters } from "@app/hooks/tools/repair/useRepairParameters";
+import { useFileSelectors } from "@app/contexts/file/fileHooks";
+import { useToolWorkflowData } from "@app/contexts/ToolWorkflowContext";
+import { alert } from "@app/components/toast";
+import type { FileId } from "@app/types/file";
+
+export interface DamagedFileRepair {
+ /** Repairs the file in place: the output replaces it as a new version. */
+ repair: (fileId: FileId) => void;
+ /** The file being repaired; one runs at a time. */
+ repairingFileId: FileId | null;
+}
+
+const DamagedFileRepairContext = createContext<DamagedFileRepair | undefined>(
+ undefined,
+);
+
+/**
+ * One Repair runner for every damaged-file action. Mounted once because the operation hook
+ * subscribes to the whole file list, which would re-render every card that held its own.
+ */
+export function DamagedFileRepairProvider({
+ children,
+}: {
+ children: ReactNode;
+}) {
+ const { t } = useTranslation();
+ const operation = useRepairOperation();
+ const selectors = useFileSelectors();
+ const { toolAvailability } = useToolWorkflowData();
+ const [repairing, setRepairing] = useState<{
+ id: FileId;
+ name: string;
+ finished: boolean;
+ } | null>(null);
+
+ // Read through refs so repair keeps one identity: memoized sidebar rows receive it.
+ const latest = useRef({ repairing, operation, selectors });
+ latest.current = { repairing, operation, selectors };
+ const repair = useCallback((fileId: FileId) => {
+ const { repairing: busy, operation: op, selectors: files } = latest.current;
+ if (busy) return;
+ const file = files.getFile(fileId);
+ if (!file) return;
+ setRepairing({ id: fileId, name: file.name, finished: false });
+ void op
+ .executeOperation(defaultParameters, [file])
+ .finally(() =>
+ setRepairing((current) =>
+ current?.id === fileId ? { ...current, finished: true } : current,
+ ),
+ );
+ }, []);
+
+ // Read after the run's state has rendered; a rejected file can end without an error message.
+ useEffect(() => {
+ if (!repairing?.finished) return;
+ if (operation.outputFileIds?.length) {
+ alert({
+ alertType: "success",
+ title: t("damagedPdf.repaired", "Repaired {{name}}", {
+ name: repairing.name,
+ }),
+ expandable: false,
+ durationMs: 3000,
+ });
+ } else {
+ alert({
+ alertType: "error",
+ title: t("damagedPdf.repairFailed", "Couldn't repair {{name}}", {
+ name: repairing.name,
+ }),
+ body: operation.errorMessage ?? undefined,
+ expandable: false,
+ durationMs: 6000,
+ });
+ }
+ operation.resetResults();
+ setRepairing(null);
+ }, [repairing, operation, t]);
+
+ const available = toolAvailability.repair?.available !== false;
+ const value = useMemo(
+ () =>
+ available
+ ? { repair, repairingFileId: repairing?.id ?? null }
+ : undefined,
+ [available, repair, repairing?.id],
+ );
+
+ return (
+ <DamagedFileRepairContext.Provider value={value}>
+ {children}
+ </DamagedFileRepairContext.Provider>
+ );
+}
+
+/** Undefined when the server has Repair disabled, so callers hide the action. */
+export function useDamagedFileRepair(): DamagedFileRepair | undefined {
+ return useContext(DamagedFileRepairContext);
+}
diff --git a/frontend/editor/src/core/contexts/file/addFiles.damageCheck.test.ts b/frontend/editor/src/core/contexts/file/addFiles.damageCheck.test.ts
new file mode 100644
index 0000000000..cf96d41b12
--- /dev/null
+++ b/frontend/editor/src/core/contexts/file/addFiles.damageCheck.test.ts
@@ -0,0 +1,116 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, test, vi } from "vitest";
+import type {
+ FileContextAction,
+ FileContextState,
+} from "@app/types/fileContext";
+import type { FileId } from "@app/types/file";
+import { isDamageCheckPending } from "@app/services/pendingDamageChecks";
+
+// Damage is only known once hydration has parsed a file, so the check must be open before the
+// upload is published (or a policy could read the file first) and must close however hydration ends.
+
+const generateThumbnailPairWithMetadata = vi.hoisted(() => vi.fn());
+vi.mock("@app/services/fileStorage", () => ({
+ fileStorage: {
+ storeStirlingFile: vi.fn().mockResolvedValue(undefined),
+ updateThumbnail: vi.fn(),
+ },
+}));
+vi.mock("@app/utils/thumbnailUtils", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@app/utils/thumbnailUtils")>()),
+ generateThumbnailPairWithMetadata,
+ generateThumbnailForFile: vi.fn(),
+}));
+vi.mock("@app/services/fileAnalyzer", () => ({
+ FileAnalyzer: { isPDFEncrypted: vi.fn().mockResolvedValue(false) },
+}));
+
+import { addFiles } from "@app/contexts/file/fileActions";
+import { LARGE_PDF_PARSE_LIMIT } from "@app/utils/thumbnailUtils";
+
+function harness() {
+ const state = {
+ files: { ids: [], byId: {} },
+ pinnedFiles: new Set(),
+ ui: { selectedFileIds: [], selectedPageNumbers: [] },
+ } as unknown as FileContextState;
+ const pendingAtPublish: boolean[] = [];
+ const dispatch = vi.fn((action: FileContextAction) => {
+ if (action.type === "ADD_FILES")
+ for (const stub of action.payload.stirlingFileStubs)
+ pendingAtPublish.push(isDamageCheckPending(stub.id));
+ });
+ const lifecycleManager = {
+ updateStirlingFileStub: vi.fn(),
+ removeFiles: vi.fn(),
+ trackBlobUrl: vi.fn(),
+ };
+ return {
+ stateRef: { current: state },
+ filesRef: { current: new Map<FileId, File>() },
+ dispatch,
+ lifecycleManager,
+ pendingAtPublish,
+ };
+}
+
+const run = (h: ReturnType<typeof harness>, file: File) =>
+ addFiles(
+ { files: [file], skipUploadTracking: true },
+ h.stateRef,
+ h.filesRef,
+ h.dispatch,
+ h.lifecycleManager as never,
+ false,
+ );
+
+const pdf = (name = "broken.pdf") =>
+ new File(["%PXF-1.7"], name, { type: "application/pdf" });
+
+beforeEach(() => generateThumbnailPairWithMetadata.mockReset());
+
+describe("damage checks during import", () => {
+ test("open before publishing and record the damage when hydration settles", async () => {
+ generateThumbnailPairWithMetadata.mockResolvedValue({
+ unrotated: { thumbnail: "", pageCount: 0, isDamaged: true },
+ rotated: { thumbnail: "", pageCount: 0, isDamaged: true },
+ });
+ const h = harness();
+ const [added] = await run(h, pdf());
+
+ expect(h.pendingAtPublish).toEqual([true]);
+ await vi.waitFor(() =>
+ expect(isDamageCheckPending(added.fileId)).toBe(false),
+ );
+ expect(h.lifecycleManager.updateStirlingFileStub).toHaveBeenCalledWith(
+ added.fileId,
+ expect.objectContaining({
+ processedFile: expect.objectContaining({ isDamaged: true }),
+ }),
+ h.stateRef,
+ );
+ });
+
+ test("settle when hydration ends without metadata", async () => {
+ // A non-damage failure (timeout, memory) resolves with no thumbnail and no damage flag.
+ generateThumbnailPairWithMetadata.mockResolvedValue({
+ unrotated: { thumbnail: "", pageCount: 0, isDamaged: false },
+ rotated: { thumbnail: "", pageCount: 0, isDamaged: false },
+ });
+ const h = harness();
+ const [added] = await run(h, pdf("fails.pdf"));
+ await vi.waitFor(() =>
+ expect(isDamageCheckPending(added.fileId)).toBe(false),
+ );
+ expect(h.lifecycleManager.updateStirlingFileStub).not.toHaveBeenCalled();
+ });
+
+ test("never hold a large file, whose prefix parse cannot prove damage", async () => {
+ const h = harness();
+ const large = pdf("large.pdf");
+ Object.defineProperty(large, "size", { value: LARGE_PDF_PARSE_LIMIT });
+ await run(h, large);
+ expect(h.pendingAtPublish).toEqual([false]);
+ });
+});
diff --git a/frontend/editor/src/core/contexts/file/fileActions.ts b/frontend/editor/src/core/contexts/file/fileActions.ts
index defdf93d3a..09debae81d 100644
--- a/frontend/editor/src/core/contexts/file/fileActions.ts
+++ b/frontend/editor/src/core/contexts/file/fileActions.ts
@@ -19,6 +19,11 @@ import {
} from "@app/types/fileContext";
import { FileId, ToolOperation } from "@app/types/file";
import { generateThumbnailPairWithMetadata } from "@app/utils/thumbnailUtils";
+import { LARGE_PDF_PARSE_LIMIT } from "@app/utils/pdfParseLimit";
+import {
+ beginDamageCheck,
+ settleDamageCheck,
+} from "@app/services/pendingDamageChecks";
import { FileLifecycleManager } from "@app/contexts/file/lifecycle";
import { buildQuickKeySet } from "@app/contexts/file/fileSelectors";
import { StirlingFile } from "@app/types/fileContext";
@@ -148,6 +153,10 @@ export async function generateProcessedFileMetadata(
const { unrotated: unrotatedResult, rotated: rotatedResult } =
await generateThumbnailPairWithMetadata(file);
+ if (unrotatedResult.isDamaged) {
+ return { pages: [], totalPages: 0, isDamaged: true };
+ }
+
// Large PDF whose linearized-prefix attempt failed: report "no metadata"
// (the tolerated failure shape) rather than a bogus zero-page document.
if (
@@ -173,6 +182,8 @@ export async function generateProcessedFileMetadata(
unrotatedResult.isEncrypted ||
rotatedResult.isEncrypted,
);
+ // Explicit, so hydration's merge over the previous metadata clears it after a repair.
+ processedFile.isDamaged = false;
return processedFile;
} catch (error) {
@@ -625,7 +636,8 @@ export async function addFiles(
}
}
};
- if (!options.skipMetadataHydration) pendingHydrations.push(hydrate);
+ if (!options.skipMetadataHydration)
+ pendingHydrations.push(trackDamageCheck(fileId, file, hydrate));
reportBulkAddProgress(++scannedCount, filesToProcess.length);
const chunkWrites = flushChunk();
@@ -860,7 +872,7 @@ export function hydrateMetadataFor(
): void {
if (!stirlingFile.type.startsWith("application/pdf")) return;
const lifetime = pdfAccessLifetime(stirlingFile);
- scheduleMetadataHydration(async () => {
+ const hydrate = async () => {
if (lifetime.aborted) return;
const processedFileMetadata =
await generateProcessedFileMetadata(stirlingFile);
@@ -883,7 +895,23 @@ export function hydrateMetadataFor(
}
lifecycleManager.updateStirlingFileStub(fileId, updates, stateRef);
- });
+ };
+ scheduleMetadataHydration(trackDamageCheck(fileId, stirlingFile, hydrate));
+}
+
+/**
+ * Damage is detected by hydration's whole-file parse, so the check is open from scheduling until the
+ * task ends however it ends. Large files only get a prefix parse, which cannot prove damage.
+ */
+function trackDamageCheck(
+ fileId: FileId,
+ file: File,
+ task: () => Promise<void>,
+): () => Promise<void> {
+ const isPdf = file.type === "application/pdf" || /\.pdf$/i.test(file.name);
+ if (!isPdf || file.size >= LARGE_PDF_PARSE_LIMIT) return task;
+ beginDamageCheck(fileId);
+ return () => task().finally(() => settleDamageCheck(fileId));
}
/** Hand the reconciler the workbench, so it can settle a record in place
diff --git a/frontend/editor/src/core/services/pdfSessionUnlock.damaged.test.ts b/frontend/editor/src/core/services/pdfSessionUnlock.damaged.test.ts
new file mode 100644
index 0000000000..bebce7095f
--- /dev/null
+++ b/frontend/editor/src/core/services/pdfSessionUnlock.damaged.test.ts
@@ -0,0 +1,70 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { PdfErrorCode } from "@embedpdf/models";
+import { createStirlingFile } from "@app/types/fileContext";
+import {
+ ensureLocalPdfAccess,
+ getPdfAccess,
+} from "@app/services/pdfAccessService";
+import {
+ preflightPdfOperation,
+ prepareUnlockedFile,
+} from "@app/services/pdfSessionUnlock";
+
+vi.mock("@app/services/apiClient", () => ({ default: { post: vi.fn() } }));
+vi.mock("@app/services/pdfAccessService", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@app/services/pdfAccessService")>()),
+ ensureLocalPdfAccess: vi.fn(),
+}));
+const inspect = vi.mocked(ensureLocalPdfAccess);
+const repair = "/api/v1/misc/repair";
+const unparseable = () =>
+ Object.assign(new Error("Unable to open PDF"), {
+ code: PdfErrorCode.WrongFormat,
+ });
+const pdf = (body: string) =>
+ createStirlingFile(
+ new File([body], "damaged.pdf", { type: "application/pdf" }),
+ );
+
+beforeEach(() => {
+ inspect.mockReset();
+});
+
+describe("damaged PDFs", () => {
+ it("passes unparseable bytes without an encryption hint to the server", async () => {
+ inspect.mockImplementation(async () => {
+ throw unparseable();
+ });
+ const file = pdf("%PDF-1.7 truncated");
+ await expect(prepareUnlockedFile(file, repair)).resolves.toBe(file);
+ await expect(
+ preflightPdfOperation([file], repair, false, vi.fn()),
+ ).resolves.toBe(true);
+ // Nothing proved these bytes unencrypted, so no access is recorded.
+ expect(getPdfAccess(file)).toBeUndefined();
+ });
+
+ it("still blocks unparseable bytes that look encrypted", async () => {
+ inspect.mockImplementation(async () => {
+ throw unparseable();
+ });
+ const file = pdf("%PDF-1.7 trailer << /Encrypt 5 0 R >>");
+ await expect(prepareUnlockedFile(file, repair)).rejects.toThrow(
+ "Unable to open PDF",
+ );
+ });
+
+ it.each([
+ ["a timeout", new DOMException("timed out", "TimeoutError")],
+ ["a password failure", Object.assign(new Error("x"), { code: 4 })],
+ ["a memory failure", new Error("Unable to allocate memory for this PDF")],
+ ])("does not treat %s as damage", async (_, error) => {
+ inspect.mockImplementation(async () => {
+ throw error;
+ });
+ await expect(prepareUnlockedFile(pdf("%PDF-1.7"), repair)).rejects.toBe(
+ error,
+ );
+ });
+});
diff --git a/frontend/editor/src/core/services/pdfSessionUnlock.ts b/frontend/editor/src/core/services/pdfSessionUnlock.ts
index 68cb0b22ed..05a5fb57f3 100644
--- a/frontend/editor/src/core/services/pdfSessionUnlock.ts
+++ b/frontend/editor/src/core/services/pdfSessionUnlock.ts
@@ -17,6 +17,8 @@ import {
hasPdfPermissionOverride,
pdfAllows,
} from "@app/services/pdfPermissions";
+import { isDamagedPdfError } from "@app/utils/pdfDamage";
+import { looksEncryptedFromTrailer } from "@app/utils/pdfEncryptionProbe";
const SUPPORTED_ENDPOINTS = new Set([
"/api/v1/security/add-password",
@@ -63,6 +65,24 @@ export function supportsSessionUnlock(endpoint: string | undefined): boolean {
return endpoint !== undefined && SUPPORTED_ENDPOINTS.has(endpoint);
}
+/**
+ * PDFium rejects some damaged files the server can still recover, so unparseable
+ * bytes with no encryption hint are passed through unchanged. Access is not
+ * recorded for them: nothing has proved them unencrypted.
+ */
+async function ensureAccessUnlessDamaged(
+ file: StirlingFile,
+ signal?: AbortSignal,
+): Promise<PdfAccess | undefined> {
+ try {
+ return await ensureLocalPdfAccess(file, signal);
+ } catch (error) {
+ if (isDamagedPdfError(error) && !(await looksEncryptedFromTrailer(file)))
+ return undefined;
+ throw error;
+ }
+}
+
/** Checks the whole selection before processing; encryption hints request authentication but never grant access. */
export async function preflightPdfOperation(
files: readonly StirlingFile[],
@@ -82,7 +102,7 @@ export async function preflightPdfOperation(
// Password endpoints validate the requested change themselves; unknown roles need no preflight upload.
const access = changesProtection
? getPdfAccess(file)
- : await ensureLocalPdfAccess(file, signal);
+ : await ensureAccessUnlessDamaged(file, signal);
const encrypted =
access?.encrypted ??
(endpoint === "/api/v1/security/add-password" && isKnownEncrypted(file));
@@ -167,8 +187,9 @@ export async function prepareUnlockedFile(
if (file.type !== "application/pdf" && !/\.pdf$/i.test(file.name))
return file;
const access =
- getPdfAccess(file) ?? (await ensureLocalPdfAccess(file, inspectionSignal));
- if (!access.encrypted) return file;
+ getPdfAccess(file) ??
+ (await ensureAccessUnlessDamaged(file, inspectionSignal));
+ if (!access?.encrypted) return file;
if (!supportsSessionUnlock(endpoint))
throw new Error(
i18n.t(
diff --git a/frontend/editor/src/core/services/pdfiumService.ts b/frontend/editor/src/core/services/pdfiumService.ts
index aee632d269..ce593cb139 100644
--- a/frontend/editor/src/core/services/pdfiumService.ts
+++ b/frontend/editor/src/core/services/pdfiumService.ts
@@ -420,6 +420,8 @@ export async function openRawDocument(
const bytes = data instanceof Uint8Array ? data : new Uint8Array(data);
const len = bytes.length;
const ptr = m.pdfium.wasmExports.malloc(len);
+ // Copying to address 0 would hand PDFium garbage that it reports as a format error.
+ if (!ptr) throw new Error("Unable to allocate memory for this PDF");
copyToWasmHeap(m, bytes, ptr);
const docPtr = m.FPDF_LoadMemDocument(ptr, len, password ?? "");
diff --git a/frontend/editor/src/core/services/pendingDamageChecks.ts b/frontend/editor/src/core/services/pendingDamageChecks.ts
new file mode 100644
index 0000000000..4bf3a8f1cd
--- /dev/null
+++ b/frontend/editor/src/core/services/pendingDamageChecks.ts
@@ -0,0 +1,46 @@
+/**
+ * Uploads whose damage check has not finished. Damage is only known once hydration has parsed a
+ * file, which happens after the upload is published, so browser-side work that reads the file
+ * waits for the check rather than failing on unparseable bytes.
+ *
+ * A module store rather than context, like pendingUnlocks: the readers are policy hooks in another
+ * layer that need the answer during an effect.
+ */
+
+const pending = new Set<string>();
+const listeners = new Set<() => void>();
+let version = 0;
+
+function publish(): void {
+ version += 1;
+ for (const listener of listeners) listener();
+}
+
+/**
+ * Called before a file's hydration is scheduled, so no reader can observe it unchecked. Readers
+ * test the pending set as they run, so only settling needs to wake them.
+ */
+export function beginDamageCheck(fileId: string): void {
+ pending.add(fileId);
+}
+
+/** Every begun check must settle, including hydrations that end without metadata. */
+export function settleDamageCheck(fileId: string): void {
+ if (pending.delete(fileId)) publish();
+}
+
+export function isDamageCheckPending(fileId: string): boolean {
+ return pending.has(fileId);
+}
+
+/** Changes whenever the pending set does, so a subscriber can re-run work it skipped. */
+export function damageChecksVersion(): number {
+ return version;
+}
+
+export function subscribeToDamageChecks(listener: () => void): () => void {
+ listeners.add(listener);
+ return () => {
+ listeners.delete(listener);
+ };
+}
diff --git a/frontend/editor/src/core/tests/stubbed/damaged-pdf-repair.spec.ts b/frontend/editor/src/core/tests/stubbed/damaged-pdf-repair.spec.ts
new file mode 100644
index 0000000000..efe9a99dc2
--- /dev/null
+++ b/frontend/editor/src/core/tests/stubbed/damaged-pdf-repair.spec.ts
@@ -0,0 +1,144 @@
+import path from "node:path";
+import { readFile } from "node:fs/promises";
+import type { Page } from "@playwright/test";
+import { test, expect } from "@app/tests/helpers/stub-test-base";
+
+// PDFium cannot parse this header, but the server's parser can; see generate-damaged-sample.py.
+const damaged = path.join(
+ import.meta.dirname,
+ "../test-fixtures/damaged-header.pdf",
+);
+const sample = path.join(import.meta.dirname, "../test-fixtures/sample.pdf");
+
+test("a damaged PDF is labelled and repaired from the viewer", async ({
+ page,
+}) => {
+ const repaired = await readFile(sample);
+ const uploads: number[] = [];
+ await page.route("**/api/v1/misc/repair", async (route) => {
+ uploads.push(route.request().postDataBuffer()?.length ?? 0);
+ await route.fulfill({
+ contentType: "application/pdf",
+ body: repaired,
+ headers: { "content-disposition": 'attachment; filename="repaired.pdf"' },
+ });
+ });
+
+ await page.getByTestId("file-input").setInputFiles(damaged);
+
+ const message = page.getByRole("alert").filter({ hasText: /damaged/ });
+ await expect(message).toBeVisible();
+ await expect(page.getByText("Damaged", { exact: true })).toBeVisible();
+
+ await page.getByRole("button", { name: "Repair", exact: true }).click();
+ // Repair runs in place: no tool panel, the repaired version replaces the file.
+ await expect(page.getByText("Repaired damaged-header.pdf")).toBeVisible();
+
+ expect(uploads, "the damaged bytes reach the server").toHaveLength(1);
+ await expect(page.getByText("Damaged", { exact: true })).toHaveCount(0);
+ await expect(message).toHaveCount(0);
+});
+
+/** Hover the row (the kebab only shows on hover) and open its menu. */
+async function openRowMenu(page: Page, name: string) {
+ const row = page.locator(".file-sidebar-file-item").filter({ hasText: name });
+ await row.hover();
+ await row.locator(".file-sidebar-kebab-btn").click();
+ const menu = page.getByRole("menu");
+ await expect(menu.getByRole("menuitem", { name: "Rename" })).toBeVisible();
+ return { row, menu };
+}
+
+test("the file menu offers Repair for a damaged file", async ({ page }) => {
+ await page.getByTestId("file-input").setInputFiles(damaged);
+ const row = page
+ .locator(".file-sidebar-file-item")
+ .filter({ hasText: "damaged-header.pdf" });
+ // Damage is known only once hydration has parsed the file.
+ await expect(row.getByText("Damaged", { exact: true })).toBeVisible({
+ timeout: 20_000,
+ });
+ const { menu } = await openRowMenu(page, "damaged-header.pdf");
+ await expect(menu.getByRole("menuitem", { name: "Repair" })).toBeVisible();
+});
+
+test("the file menu offers no Repair for a healthy file", async ({ page }) => {
+ await page.getByTestId("file-input").setInputFiles(sample);
+ await expect(page.locator('[data-page-index="0"]').first()).toBeVisible({
+ timeout: 20_000,
+ });
+ const { menu } = await openRowMenu(page, "sample.pdf");
+ await expect(menu.getByRole("menuitem", { name: "Repair" })).toHaveCount(0);
+});
+
+test.describe("when the server has Repair disabled", () => {
+ test.use({
+ stubOptions: { endpointsAvailability: { repair: { enabled: false } } },
+ });
+
+ test("the damage is still shown but no Repair action is offered", async ({
+ page,
+ }) => {
+ await page.getByTestId("file-input").setInputFiles(damaged);
+ await expect(
+ page.getByRole("alert").filter({ hasText: /damaged/ }),
+ ).toBeVisible();
+ await expect(
+ page.getByRole("button", { name: "Repair", exact: true }),
+ ).toHaveCount(0);
+ await expect(
+ page.getByRole("button", { name: "Retry", exact: true }),
+ ).toBeVisible();
+ });
+});
+
+test("the Active Files card shows the damage and repairs it", async ({
+ page,
+}) => {
+ const uploads: number[] = [];
+ await page.route("**/api/v1/misc/repair", async (route) => {
+ uploads.push(1);
+ await route.fulfill({
+ contentType: "application/pdf",
+ body: await readFile(sample),
+ });
+ });
+ await page.getByTestId("file-input").setInputFiles([damaged, sample]);
+ const card = page
+ .getByTestId("file-thumbnail")
+ .filter({ hasText: "damaged-header.pdf" });
+ await expect(card.getByText("Damaged", { exact: true })).toBeVisible();
+ await expect(card.getByText(/Loading thumbnail/)).toHaveCount(0);
+ const healthy = page
+ .getByTestId("file-thumbnail")
+ .filter({ hasText: "sample.pdf" });
+ await expect(healthy.getByRole("button", { name: "Repair" })).toHaveCount(0);
+
+ // Both the overlay and the hover bar offer Repair; the hover bar is the card's usual action surface.
+ await card.hover();
+ await card
+ .locator("[data-hover-action-menu]")
+ .getByRole("button", { name: "Repair", exact: true })
+ .click();
+ // Repair runs in place: no tool panel, the repaired version replaces the file.
+ await expect(page.getByText("Repaired damaged-header.pdf")).toBeVisible();
+ expect(uploads).toHaveLength(1);
+ await expect(page.getByText("Damaged", { exact: true })).toHaveCount(0);
+});
+
+test("a failed repair says so and keeps the file marked damaged", async ({
+ page,
+}) => {
+ await page.route("**/api/v1/misc/repair", (route) =>
+ route.fulfill({ status: 500, json: { message: "Repair failed" } }),
+ );
+ await page.getByTestId("file-input").setInputFiles(damaged);
+ await page.getByRole("button", { name: "Repair", exact: true }).click();
+ await expect(
+ page.getByText("Couldn't repair damaged-header.pdf"),
+ ).toBeVisible();
+ await expect(page.getByText("Damaged", { exact: true })).toBeVisible();
+ await expect(
+ page.getByRole("button", { name: "Repair", exact: true }),
+ ).toBeEnabled();
+});
diff --git a/frontend/editor/src/core/tests/test-fixtures/damaged-header.pdf b/frontend/editor/src/core/tests/test-fixtures/damaged-header.pdf
new file mode 100644
index 0000000000..b39dc4d293
Binary files /dev/null and b/frontend/editor/src/core/tests/test-fixtures/damaged-header.pdf differ
diff --git a/frontend/editor/src/core/tests/test-fixtures/generate-damaged-sample.py b/frontend/editor/src/core/tests/test-fixtures/generate-damaged-sample.py
new file mode 100644
index 0000000000..0b9299afa0
--- /dev/null
+++ b/frontend/editor/src/core/tests/test-fixtures/generate-damaged-sample.py
@@ -0,0 +1,11 @@
+"""Writes damaged-header.pdf: sample.pdf with a corrupted %PDF header.
+
+PDFium rejects the result as a format error, while lenient parsers such as
+PDFBox recover it, which is the case the damaged-file Repair flow exists for.
+"""
+
+from pathlib import Path
+
+here = Path(__file__).parent
+source = (here / "sample.pdf").read_bytes()
+(here / "damaged-header.pdf").write_bytes(b"%PXF" + source[4:])
diff --git a/frontend/editor/src/core/types/fileContext.ts b/frontend/editor/src/core/types/fileContext.ts
index 709e8018ab..49afd3dcad 100644
--- a/frontend/editor/src/core/types/fileContext.ts
+++ b/frontend/editor/src/core/types/fileContext.ts
@@ -38,6 +38,8 @@ export interface ProcessedFileMetadata {
isEncrypted?: boolean;
/** Verified opening-password requirement; absence means it has not been checked. */
requiresOpeningPassword?: boolean;
+ /** PDFium could not parse the file; Repair may recover it on the server. */
+ isDamaged?: boolean;
thumbnailUrl?: string;
[key: string]: unknown;
}
diff --git a/frontend/editor/src/core/utils/pdfDamage.ts b/frontend/editor/src/core/utils/pdfDamage.ts
new file mode 100644
index 0000000000..9fa81e77e6
--- /dev/null
+++ b/frontend/editor/src/core/utils/pdfDamage.ts
@@ -0,0 +1,11 @@
+import { PdfErrorCode } from "@embedpdf/models";
+
+/**
+ * PDFium's file and format failures mean the bytes cannot be parsed. Timeouts,
+ * memory limits, cancellation and passwords say nothing about the file itself.
+ */
+export function isDamagedPdfError(error: unknown): boolean {
+ if (error instanceof DOMException) return false;
+ const code = (error as { code?: unknown } | null)?.code;
+ return code === PdfErrorCode.NotFound || code === PdfErrorCode.WrongFormat;
+}
diff --git a/frontend/editor/src/core/utils/pdfParseLimit.ts b/frontend/editor/src/core/utils/pdfParseLimit.ts
new file mode 100644
index 0000000000..d800baa50b
--- /dev/null
+++ b/frontend/editor/src/core/utils/pdfParseLimit.ts
@@ -0,0 +1,2 @@
+/** Thumbnail parsing above this limit uses a bounded prefix to avoid exhausting renderer memory. */
+export const LARGE_PDF_PARSE_LIMIT = 100 * 1024 * 1024;
diff --git a/frontend/editor/src/core/utils/thumbnailUtils.damage.test.ts b/frontend/editor/src/core/utils/thumbnailUtils.damage.test.ts
new file mode 100644
index 0000000000..a91a36a9c3
--- /dev/null
+++ b/frontend/editor/src/core/utils/thumbnailUtils.damage.test.ts
@@ -0,0 +1,63 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+// A fine PDF must never be labelled damaged because PDFium was handed bytes that are not the file.
+
+const openRawDocumentSafe = vi.hoisted(() => vi.fn());
+const getDocumentBytes = vi.hoisted(() => vi.fn());
+vi.mock("@app/services/pdfiumService", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@app/services/pdfiumService")>()),
+ getPdfiumModule: vi.fn().mockResolvedValue({}),
+ openRawDocumentSafe,
+}));
+vi.mock("@app/services/documentBytesCache", () => ({ getDocumentBytes }));
+
+import { PdfiumOpenError } from "@app/services/pdfiumService";
+import { generateThumbnailPairWithMetadata } from "@app/utils/thumbnailUtils";
+
+const FORMAT_ERROR = 3;
+const pdf = (body: string) =>
+ new File([body], "doc.pdf", { type: "application/pdf" });
+const bytesOf = (file: File) => new Uint8Array(file.size).buffer;
+
+beforeEach(() => {
+ openRawDocumentSafe.mockReset();
+ getDocumentBytes.mockReset();
+ vi.spyOn(console, "warn").mockImplementation(() => {});
+});
+
+describe("damage detection", () => {
+ it("flags a whole file PDFium rejects as malformed", async () => {
+ const file = pdf("%PXF-1.7 broken");
+ getDocumentBytes.mockResolvedValue(bytesOf(file));
+ openRawDocumentSafe.mockRejectedValue(new PdfiumOpenError(FORMAT_ERROR));
+ const { unrotated } = await generateThumbnailPairWithMetadata(file);
+ expect(unrotated.isDamaged).toBe(true);
+ });
+
+ it("does not flag a short read, which says nothing about the file", async () => {
+ const file = pdf("%PDF-1.7 a perfectly fine document");
+ getDocumentBytes.mockResolvedValue(new ArrayBuffer(0));
+ openRawDocumentSafe.mockRejectedValue(new PdfiumOpenError(FORMAT_ERROR));
+ const { unrotated } = await generateThumbnailPairWithMetadata(file);
+ expect(unrotated.isDamaged).toBe(false);
+ });
+
+ it("does not flag a file that looks encrypted", async () => {
+ const file = pdf("%PDF-1.7 trailer << /Encrypt 9 0 R >>");
+ getDocumentBytes.mockResolvedValue(bytesOf(file));
+ openRawDocumentSafe.mockRejectedValue(new PdfiumOpenError(FORMAT_ERROR));
+ const { unrotated } = await generateThumbnailPairWithMetadata(file);
+ expect(unrotated.isDamaged).toBe(false);
+ });
+
+ it("does not flag a memory failure", async () => {
+ const file = pdf("%PDF-1.7");
+ getDocumentBytes.mockResolvedValue(bytesOf(file));
+ openRawDocumentSafe.mockRejectedValue(
+ new Error("Unable to allocate memory for this PDF"),
+ );
+ const { unrotated } = await generateThumbnailPairWithMetadata(file);
+ expect(unrotated.isDamaged).toBe(false);
+ });
+});
diff --git a/frontend/editor/src/core/utils/thumbnailUtils.ts b/frontend/editor/src/core/utils/thumbnailUtils.ts
index a969192404..1d9797a985 100644
--- a/frontend/editor/src/core/utils/thumbnailUtils.ts
+++ b/frontend/editor/src/core/utils/thumbnailUtils.ts
@@ -13,6 +13,8 @@ import { jpegExifOrientation } from "@app/utils/jpegOrientation";
import { getDocumentBytes } from "@app/services/documentBytesCache";
import { getPdfAccess } from "@app/services/pdfAccessService";
import { looksEncryptedFromTrailer } from "@app/utils/pdfEncryptionProbe";
+import { isDamagedPdfError } from "@app/utils/pdfDamage";
+import { LARGE_PDF_PARSE_LIMIT } from "@app/utils/pdfParseLimit";
export interface ThumbnailWithMetadata {
thumbnail: string; // Always returns a thumbnail (placeholder if needed)
@@ -20,6 +22,8 @@ export interface ThumbnailWithMetadata {
pageRotations?: number[]; // Rotation for each page (0, 90, 180, 270)
pageDimensions?: Array<{ width: number; height: number }>;
isEncrypted?: boolean;
+ /** PDFium could not parse the whole file; never set from a large-file prefix. */
+ isDamaged?: boolean;
}
/**
@@ -40,8 +44,7 @@ function reportThumbnailFailure(file: File, error: unknown): void {
console.warn(`Thumbnail generation failed for ${file.name}:`, error);
}
-/** Thumbnail parsing above this limit uses a bounded prefix to avoid exhausting renderer memory. */
-export const LARGE_PDF_PARSE_LIMIT = 100 * 1024 * 1024;
+export { LARGE_PDF_PARSE_LIMIT };
/** Linearized PDFs keep page 1 + hint tables in the first bytes, so a small
* prefix is often enough to render a thumbnail without reading the file. */
@@ -641,6 +644,7 @@ export async function generateThumbnailPairWithMetadata(file: File): Promise<{
}> {
const scale = calculateScaleFromFileSize(file.size);
const isLarge = file.size >= LARGE_PDF_PARSE_LIMIT;
+ let parsedBytes = 0;
try {
// Probe inside the try: an unreadable file must still resolve, or the
// caller leaves the card with no metadata and a spinner that never stops.
@@ -659,6 +663,7 @@ export async function generateThumbnailPairWithMetadata(file: File): Promise<{
const buffer = isLarge
? await file.slice(0, LINEARIZED_PREFIX_BYTES).arrayBuffer()
: await getDocumentBytes(file);
+ parsedBytes = buffer.byteLength;
const pair = await renderPdfThumbnailPairPdfium(
buffer,
scale,
@@ -681,9 +686,16 @@ export async function generateThumbnailPairWithMetadata(file: File): Promise<{
};
} catch (error) {
reportThumbnailFailure(file, error);
+ // Damage needs PDFium to have rejected the whole file: a prefix (large files) or a short read
+ // fails on bytes that are not the file. Unsupported encryption can also read as a format error.
+ const isDamaged =
+ !isLarge &&
+ parsedBytes === file.size &&
+ isDamagedPdfError(error) &&
+ !(await looksEncryptedFromTrailer(file).catch(() => true));
return {
- unrotated: { thumbnail: "", pageCount: 0 },
- rotated: { thumbnail: "", pageCount: 0 },
+ unrotated: { thumbnail: "", pageCount: 0, isDamaged },
+ rotated: { thumbnail: "", pageCount: 0, isDamaged },
};
}
}
diff --git a/frontend/editor/src/proprietary/components/policies/usePolicyLocalPasses.test.tsx b/frontend/editor/src/proprietary/components/policies/usePolicyLocalPasses.test.tsx
index be91cc90bb..25e24c02f2 100644
--- a/frontend/editor/src/proprietary/components/policies/usePolicyLocalPasses.test.tsx
+++ b/frontend/editor/src/proprietary/components/policies/usePolicyLocalPasses.test.tsx
@@ -3,7 +3,7 @@
// heuristic engine, the meter, the shared dispatch primitive).
import { describe, it, expect, vi, beforeEach } from "vitest";
-import { renderHook, waitFor } from "@testing-library/react";
+import { act, renderHook, waitFor } from "@testing-library/react";
import {
markDispatched,
resetPolicyRuns,
@@ -15,19 +15,14 @@ interface TestStub {
lastModified: number;
derivedFromTool?: boolean;
classificationLabels?: string[];
+ processedFile?: { pages: never[]; isDamaged?: boolean };
}
const aiEnabled = vi.hoisted(() => ({ value: false }));
const runOn = vi.hoisted(() => ({ value: "upload" as "upload" | "export" }));
const mocks = vi.hoisted(() => ({
- workspace: [] as Array<{
- id: string;
- name: string;
- lastModified: number;
- derivedFromTool?: boolean;
- classificationLabels?: string[];
- }>,
+ workspace: [] as TestStub[],
configLoading: false,
updateStirlingFileStub: vi.fn(),
bumpRevision: vi.fn(),
@@ -92,6 +87,10 @@ vi.mock("@app/services/automationMeter", () => ({
}));
import { usePolicyLocalPasses } from "@app/components/policies/usePolicyLocalPasses";
+import {
+ beginDamageCheck,
+ settleDamageCheck,
+} from "@app/services/pendingDamageChecks";
// Run idle callbacks immediately so batches start without timer waits.
vi.stubGlobal("requestIdleCallback", (cb: () => void) => {
@@ -378,4 +377,39 @@ describe("usePolicyLocalPasses delivery", () => {
expect(mocks.meter).not.toHaveBeenCalled();
expect(mocks.runPolicyOnFile).not.toHaveBeenCalled();
});
+
+ it("never classifies a damaged file, which would only fail to read it", async () => {
+ mocks.workspace = [
+ stub("broken", { processedFile: { pages: [], isDamaged: true } }),
+ stub("fine"),
+ ];
+ mocks.classify.mockResolvedValue({ labels: ["invoice"] });
+
+ renderHook(() => usePolicyLocalPasses());
+
+ await waitFor(() =>
+ expect(mocks.updateStirlingFileStub).toHaveBeenCalledWith("fine", {
+ classificationLabels: ["invoice"],
+ }),
+ );
+ expect(mocks.classify).toHaveBeenCalledTimes(1);
+ expect(mocks.getStirlingFile).not.toHaveBeenCalledWith("broken");
+ });
+
+ it("holds a file until its damage check settles, then classifies it", async () => {
+ beginDamageCheck("checking");
+ mocks.workspace = [stub("checking")];
+ mocks.classify.mockResolvedValue({ labels: ["invoice"] });
+
+ renderHook(() => usePolicyLocalPasses());
+ await new Promise((resolve) => setTimeout(resolve, 20));
+ expect(mocks.classify).not.toHaveBeenCalled();
+
+ act(() => settleDamageCheck("checking"));
+ await waitFor(() =>
+ expect(mocks.updateStirlingFileStub).toHaveBeenCalledWith("checking", {
+ classificationLabels: ["invoice"],
+ }),
+ );
+ });
});
diff --git a/frontend/editor/src/proprietary/components/policies/usePolicyLocalPasses.ts b/frontend/editor/src/proprietary/components/policies/usePolicyLocalPasses.ts
index d41798b443..967552eace 100644
--- a/frontend/editor/src/proprietary/components/policies/usePolicyLocalPasses.ts
+++ b/frontend/editor/src/proprietary/components/policies/usePolicyLocalPasses.ts
@@ -5,7 +5,13 @@
* is still needed (and the AI engine, if the policy needs it, is on).
*/
-import { useEffect, useMemo, useRef, useState } from "react";
+import {
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+ useSyncExternalStore,
+} from "react";
import { useAllFiles, useFileManagement } from "@app/contexts/FileContext";
import { useAppConfig } from "@app/contexts/AppConfigContext";
import { useIndexedDB } from "@app/contexts/IndexedDBContext";
@@ -22,6 +28,11 @@ import {
import { policyRequiresAiEngine } from "@app/data/classificationPolicy";
import { editorTriggerOf } from "@app/policies/runOn";
import type { StirlingFileStub } from "@app/types/fileContext";
+import {
+ damageChecksVersion,
+ isDamageCheckPending,
+ subscribeToDamageChecks,
+} from "@app/services/pendingDamageChecks";
/** Files processed per idle pass, so a large upload drains over several ticks instead of janking. */
const LOCAL_PASS_BATCH = 3;
@@ -48,6 +59,12 @@ export function usePolicyLocalPasses(): void {
const claimed = useRef<Set<string>>(new Set());
// Bumped after each batch to drain the next one.
const [tick, setTick] = useState(0);
+ // A settled damage check re-runs the batch; nothing else changes when a held file is released.
+ const damageVersion = useSyncExternalStore(
+ subscribeToDamageChecks,
+ damageChecksVersion,
+ damageChecksVersion,
+ );
// Active editor upload policies that declare a local fast path.
const passes = useMemo<ActivePass[]>(() => {
@@ -77,6 +94,10 @@ export function usePolicyLocalPasses(): void {
if (batch.length >= LOCAL_PASS_BATCH) break outer;
// Null when the classification is locked: no pass, and so no escalation.
if (!dispatchableFileId(stub)) continue;
+ // Local passes read the bytes in the browser, so they wait for the damage check and never
+ // run on a file PDFium cannot parse. A repaired version is a new file and runs then.
+ if (isDamageCheckPending(stub.id)) continue;
+ if (stub.processedFile?.isDamaged) continue;
if (!active.pass.eligible(stub)) continue;
if (claimed.current.has(claimKey(active.policyKey, stub))) continue;
batch.push({ active, stub });
@@ -142,5 +163,6 @@ export function usePolicyLocalPasses(): void {
updateStirlingFileStub,
bumpRevision,
tick,
+ damageVersion,
]);
}