Skip to content

fix: keep the detected extension on URL job file names - #499

Open
RaphaelFakhri wants to merge 1 commit into
Ontos-AI:mainfrom
RaphaelFakhri:fix/RaphaelFakhri/url-file-name-extension
Open

RaphaelFakhri wants to merge 1 commit into
Ontos-AI:mainfrom
RaphaelFakhri:fix/RaphaelFakhri/url-file-name-extension

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Summary

  • _resolve_url_source_file_name now keeps the request file_name only when its extension matches the extension detected for the URL. Otherwise it appends the detected extension, the same way the URL basename path already does. For example, annual-report.docx on a URL that serves a PDF becomes annual-report.docx.pdf.
  • Before this change, any name with an extension was kept as-is. The page-memory track routes on the source_file_name extension, so a v2 URL job for a PDF with file_name="annual-report.docx" was accepted and then failed in normalize_to_pdf with page_memory parse track only supports PDF and PPTX.
  • Names that already match, such as hipo-upload-optimization_a884bd1b.plan.md on an .md URL, are unchanged. The comparison ignores case, so Report.PDF is kept.
  • No API schema, worker, or migration change.
  • Fixes [Bug]: URL job file_name with a different extension breaks the page-memory parse #498

Verification

  • uv run pytest apps/api/tests/unit/test_document_ingestion_filename.py -q: 6 passed. With the source change reverted, the new mismatch test fails (1 failed, 5 passed).
  • ruff check on the changed files: passed.
  • Did not run the PostgreSQL-backed contract tests or a live URL ingest.

Deployment Notes

  • No new environment variables.
  • No database migrations, queue changes, or storage changes.
  • Jobs that were already created keep their stored source_file_name.

Checklist

  • Tests were added or updated when behavior changed
  • Public docs, examples, or OpenAPI contracts were updated when needed
  • Database migrations are idempotent and safe to deploy
  • Logs, errors, and validation paths avoid leaking secrets or user data
  • The pull request description explains any breaking or user-visible change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: URL job file_name with a different extension breaks the page-memory parse

1 participant