Skip to content

Use HrefList only for multiple hrefs#71

Merged
rfc2822 merged 1 commit intomainfrom
hreflist
Jun 29, 2025
Merged

Use HrefList only for multiple hrefs#71
rfc2822 merged 1 commit intomainfrom
hreflist

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Jun 29, 2025

  • Owner allows only one href
  • HrefListProperty: remove shortcut to get first value because all values should be processed (shortcut encourages unclean processing)
  • remove deprecated UrlUtils.equals()

@rfc2822 rfc2822 self-assigned this Jun 29, 2025
@rfc2822 rfc2822 added the refactoring Internal improvement of existing functions label Jun 29, 2025
@rfc2822 rfc2822 requested a review from Copilot June 29, 2025 12:44
@rfc2822 rfc2822 marked this pull request as ready for review June 29, 2025 12:45
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 updates how href properties are processed by using HrefList only for multiple href elements and removing deprecated shortcuts and helpers.

  • Updated tests to reflect that only a single href is used from the provided list.
  • Removed the shortcut “href” from HrefListProperty and replaced webdav imports with common imports.
  • Removed the deprecated UrlUtils.equals() method and updated the XmlReader logic to capture only the first matching tag.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/test/kotlin/at/bitfire/dav4jvm/property/OwnerTest.kt Added tests for empty, multiple, and invalid owner hrefs
src/main/kotlin/at/bitfire/dav4jvm/property/webdav/Owner.kt Switched from extending HrefListProperty to using a dedicated href property
src/main/kotlin/at/bitfire/dav4jvm/property/common/HrefListProperty.kt Removed the first-element shortcut and updated package and API usage
Other property files (GroupMembership, AddressbookHomeSet, Source, CalendarUserAddressSet, CalendarProxyWriteFor, CalendarProxyReadFor, CalendarHomeSet) Updated imports to reference the common HrefListProperty
src/main/kotlin/at/bitfire/dav4jvm/XmlReader.kt Adjusted tag processing to capture only the first matching entry
src/main/kotlin/at/bitfire/dav4jvm/UrlUtils.kt Removed the deprecated equals() method
Comments suppressed due to low confidence (2)

src/main/kotlin/at/bitfire/dav4jvm/XmlReader.kt:93

  • It would be helpful to document that the extra condition 'result == null' is purposely used to capture only the first matching tag, ensuring consistent processing of multiple href elements.
            if (eventType == XmlPullParser.START_TAG && parser.depth == depth + 1 && parser.propertyName() == name && result == null)

src/main/kotlin/at/bitfire/dav4jvm/property/common/HrefListProperty.kt:24

  • Since the shortcut accessor 'href' was removed in favor of processing all href values separately, please consider adding a comment clarifying this change for future maintainability.
abstract class HrefListProperty(

@rfc2822 rfc2822 merged commit cf5d283 into main Jun 29, 2025
5 checks passed
@rfc2822 rfc2822 deleted the hreflist branch June 29, 2025 12:45
@github-project-automation github-project-automation bot moved this from Todo to Done in DAVx⁵ Releases Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Internal improvement of existing functions

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant