🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
Fix Paperless upload task polling for JSON-encoded task IDs; add missing paperless i18n strings
Omega (QA)4d1093d0ce2e
diff --git a/backend/paperless_handler.py b/backend/paperless_handler.pyindex b0416ee..c84dfc4 100644--- a/backend/paperless_handler.py+++ b/backend/paperless_handler.py@@ -320,8 +320,16 @@ class PaperlessHandler:document_id = int(id_match.group(1))logger.info(f"Extracted document ID from string: {document_id}")return True, document_id, f"Document uploaded successfully: {result}"- else:+ # The string may be a JSON-encoded task UUID (e.g. '"<uuid>"');+ # poll the task endpoint the same way as for plain-text UUIDs.+ uuid_pattern = re.compile(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")+ if uuid_pattern.match(result.strip()):+ resolved_id = self._get_document_id_from_task(result.strip())+ if resolved_id:+ return True, resolved_id, "Document uploaded and processed successfully"+ logger.info("Upload accepted; processing asynchronously (task %s)", result.strip())return True, None, f"Document uploaded successfully: {result}"+ return True, None, f"Document uploaded successfully: {result}"else:# Other response typelogger.warning(f"Unexpected response type from Paperless-ngx: {type(result)} - {result}")diff --git a/locales/en/translation.json b/locales/en/translation.jsonindex c98487f..ed76a65 100644--- a/locales/en/translation.json+++ b/locales/en/translation.json@@ -710,5 +710,23 @@"failed_to_save_claim": "Failed to save claim","failed_to_delete_claim": "Failed to delete claim","warranty_not_found": "Warranty not found"+ },+ "paperless": {+ "uploading_documents": "Uploading documents...",+ "uploading": "Uploading {{documentType}}",+ "uploading_to_server": "Uploading file to Paperless-ngx...",+ "upload_failed": "Failed to upload to Paperless-ngx",+ "upload_complete": "Document uploaded and ready!",+ "upload_processing": "Document uploaded, processing...",+ "duplicate_linked": "Duplicate document detected in Paperless-ngx. Linked to existing document.",+ "processing_search": "Document processing, searching for link...",+ "disabled": "Paperless-ngx integration is not enabled",+ "popup_blocked": "Please allow popups to view documents in Paperless-ngx",+ "documents_linked": "Documents linked successfully",+ "document_selected": "Document selected",+ "loading_documents": "Loading documents...",+ "failed_to_load": "Failed to load documents",+ "no_documents_found": "No documents found",+ "try_adjusting_filters": "Try adjusting your search terms or filters."}}