Normalize attachment filename/content type before extension checks #14

Closed
opened 2026-05-11 18:52:28 +02:00 by heiko · 4 comments
Owner

Problem

XRechnung detection uses case-sensitive suffix checks for attachment filenames.

Reference: internal/xrechnung/detector.go:19.

Attachments like INVOICE.XML with application/octet-stream will not be detected even though they may contain valid invoice XML.

Expected

Filename extension and content type checks should be normalized before matching.

Suggested fix

Lowercase the filename extension and content type before comparing, and add tests for uppercase .XML/.PDF names.

## Problem XRechnung detection uses case-sensitive suffix checks for attachment filenames. Reference: `internal/xrechnung/detector.go:19`. Attachments like `INVOICE.XML` with `application/octet-stream` will not be detected even though they may contain valid invoice XML. ## Expected Filename extension and content type checks should be normalized before matching. ## Suggested fix Lowercase the filename extension and content type before comparing, and add tests for uppercase `.XML`/`.PDF` names.
Author
Owner

Branch renamed per convention:

Old: regression/issue-14-normalize-attachment-name
New: fix/14-normalize-attachment-name

The old remote branch has been deleted.

Branch renamed per convention: Old: regression/issue-14-normalize-attachment-name New: fix/14-normalize-attachment-name The old remote branch has been deleted.
Author
Owner

Fix branch pushed: fix/14-normalize-attachment-name-claude

Normalizes filename to lowercase at the start of IsXRechnung so .XML and .PDF extensions are recognized regardless of case. Regression test passes.

Fix branch pushed: [fix/14-normalize-attachment-name-claude](https://forgejo.schlittermann.de/IUS/xr-invoiced/src/branch/fix/14-normalize-attachment-name-claude) Normalizes filename to lowercase at the start of IsXRechnung so .XML and .PDF extensions are recognized regardless of case. Regression test passes.
Author
Owner
Implementation branch: [fix/14-normalize-attachment-name-codex](https://forgejo.schlittermann.de/IUS/xr-invoiced/src/branch/fix/14-normalize-attachment-name-codex)
Author
Owner

Fixed in b801292 with test coverage in 2f47726, merged by acde9a4. Filename extensions and content types are normalized before XRechnung dispatch.

Fixed in b801292 with test coverage in 2f47726, merged by acde9a4. Filename extensions and content types are normalized before XRechnung dispatch.
heiko closed this issue 2026-05-13 14:11:47 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
IUS/xr-invoiced#14
No description provided.