Skip to content

Improve stability of thumbnail url generation#79

Merged
claucambra merged 4 commits into
mainfrom
bugfix/thumbnail-urls
May 23, 2025
Merged

Improve stability of thumbnail url generation#79
claucambra merged 4 commits into
mainfrom
bugfix/thumbnail-urls

Conversation

@claucambra
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
@claucambra claucambra added this to the 2.1 milestone May 23, 2025
@claucambra claucambra requested a review from Copilot May 23, 2025 07:24
@claucambra claucambra self-assigned this May 23, 2025
@claucambra claucambra added the bug Something isn't working label May 23, 2025
Copy link
Copy Markdown
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 refactors the thumbnail URL generation to use modern URL-building APIs with availability checks and adds a unit test to validate the new logic.

  • Switches from manual string concatenation to URL.appending(components:) and query items on supported OS versions.
  • Provides a fallback string-based URL constructor for older OS versions.
  • Introduces a unit test to verify the generated thumbnail URL.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Tests/NextcloudFileProviderKitTests/ItemMetadataTests.swift Adds a test (thumbnailUrlCorrect) to assert that thumbnailUrl(size:) produces the expected URL.
Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift Replaces legacy URL string building with appending(components:) and query items, guarded by an availability check.
Comments suppressed due to low confidence (1)

Tests/NextcloudFileProviderKitTests/ItemMetadataTests.swift:21

  • Add a complementary test case for hasPreview == false (e.g. when item.hasPreview is false) to ensure thumbnailUrl(size:) correctly returns nil.
#expect(item.thumbnailUrl(size: .init(width: 250, height: 250)) == expectedUrl)

Comment thread Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift
Comment thread Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift
Comment thread Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift
@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.24%. Comparing base (d73df81) to head (87ff073).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...xtcloudFileProviderKit/Metadata/ItemMetadata.swift 76.92% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #79      +/-   ##
==========================================
+ Coverage   81.08%   81.24%   +0.16%     
==========================================
  Files          62       63       +1     
  Lines       13505    13562      +57     
==========================================
+ Hits        10951    11019      +68     
+ Misses       2554     2543      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@claucambra claucambra merged commit 1fd2ee1 into main May 23, 2025
3 checks passed
@claucambra claucambra deleted the bugfix/thumbnail-urls branch May 23, 2025 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants