Skip to content

Conversation

@sunkup
Copy link
Member

@sunkup sunkup commented Jan 15, 2026

Purpose

Some servers respond with a malformed MIME type in the Content-Type header, which has ICSx⁵ fail with an error message. ICSx⁵ should not fail on those but try to parse the returned calendar and add the subscription anyways.

Short description

When fetching calendar data, if the server responds with a malformed MIME type in the Content-Type header, we now log a warning and proceed without a content type instead of failing with error message.

  • catch BadContentTypeFormatException and use null for content-type

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

When fetching calendar data, if the server responds with a malformed
MIME type in the Content-Type header, we now log a warning and proceed
without a content type instead of failing with error message.
@sunkup sunkup self-assigned this Jan 15, 2026
@sunkup sunkup added the enhancement New feature or request label Jan 15, 2026
@sunkup sunkup linked an issue Jan 15, 2026 that may be closed by this pull request
@sunkup sunkup requested a review from Copilot January 15, 2026 09:56
@sunkup sunkup modified the milestone: 2.4.4 Jan 15, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances error handling in the calendar fetching logic to gracefully handle malformed MIME types in server responses. Instead of failing when a server sends an invalid Content-Type header, the application now logs a warning and proceeds with calendar processing.

Changes:

  • Added exception handling for BadContentTypeFormatException when parsing Content-Type headers
  • Modified the success path to use a nullable ContentType variable, defaulting to null when parsing fails

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sunkup sunkup marked this pull request as ready for review January 15, 2026 10:51
@sunkup sunkup requested a review from ArnyminerZ January 15, 2026 10:51
@sunkup sunkup added this to the 2.4.4 milestone Jan 21, 2026
Copy link
Member

@ArnyminerZ ArnyminerZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, feel free to merge

@sunkup sunkup merged commit 5be0bac into main Jan 28, 2026
5 checks passed
@sunkup sunkup deleted the 784-allow-malformed-mime-types---ignore-badcontenttypeformatexceptions branch January 28, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow malformed mime types - ignore BadContentTypeFormatExceptions

2 participants