fix: japanese file names (backport of #2053)#2098
Conversation
* fix japanese file names
Root cause: COS/Azure/S3 connectors build document.id as the raw, non-ASCII object key ("bucket::報告書.pdf"), and that value was reused verbatim as document_id in the default Langflow ingestion path — the only ingestion path that puts non-ASCII text into ASCII-only HTTP headers and an unbounded-length OpenSearch identifier. Google Drive (opaque ASCII ID) and manual upload (content hash) were structurally immune; COS/Azure/S3 were the only paths exposed.
Fix applied (matches the already-proven split used by the non-Langflow ingestion path):
- document_index_writer.py — DocumentIndexContext gained a connector_file_id field, now written onto every indexed chunk when present.
- langflow_file_service.py — _resolve_document_id now hashes any supplied connector_file_id into a stable ASCII document_id, instead of using it verbatim; connector_file_id threads through run_ingestion_flow → _configure_ingest_callback → the JWT context.
- processors.py — the Langflow-path connector branch now passes connector_file_id=document.id (not document_id=document.id), and the post-ingest existence check / metadata sync now match on connector_file_id.
- connectors/service.py — stale comments corrected (dedupe/ACL-sync already matched both fields, no logic change needed there).
- Added 13 new unit tests (test_resolve_document_id_connector_file_id.py, test_document_index_writer_connector_file_id.py, test_bucket_connector_unicode_file_ids.py) — confirmed they fail on the old code and pass on the fix.
- Ran the full unit suite: same 14 pre-existing failures before and after (unrelated to this change — auth/settings/encryption tests), no new regressions.
* style: ruff autofix (auto)
* fix connector File name issue
* ingest fix
* Update processors.py
* review fix
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughConnector ingestion now preserves raw ChangesConnector identity propagation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ConnectorService
participant LangflowFileService
participant DocumentIndexWriter
participant OpenSearch
ConnectorService->>LangflowFileService: Upload with connector_file_id
LangflowFileService->>DocumentIndexWriter: Pass raw connector ID and hashed document ID
DocumentIndexWriter->>OpenSearch: Index chunk identifiers
ConnectorService->>OpenSearch: Update metadata using identifier match clauses
ConnectorService->>OpenSearch: Verify and delete connector chunks
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Backports #2053 from
release-saas-ga-0.6.2tomain.Fixes handling of non-ASCII (e.g. Japanese) filenames for bucket connectors by threading a
connector_file_idthrough document indexing/ingest-token context, independent of the display filename.Note on conflict resolution: cherry-pick conflicted in
src/services/langflow_file_service.pyandsrc/services/langflow_ingest_token_service.pyagainst an unrelatedparser/chunk_size/chunk_overlapfeature already onmain. Both are additive fields onDocumentIndexContext; resolved by keeping both sets of fields together.Test plan
pytest tests/unit/test_document_index_writer_connector_file_id.py tests/unit/test_resolve_document_id_connector_file_id.py tests/unit/connectors/test_bucket_connector_unicode_file_ids.py tests/unit/test_langflow_ingest_callback.py tests/unit/test_connector_processor_filename_dedupe.py tests/unit/connectors/test_update_connector_metadata_filename.py— 47 passedSummary by CodeRabbit
Bug Fixes
connector_file_id.keywordfor older mappings).Tests