DonutWare / Fladder

Fladder - A Simple Jellyfin frontend built on top of Flutter.
https://donutware.github.io/Fladder/
GNU General Public License v3.0
312 stars 14 forks source link

fix: Improve sanitizing for trickplay #158

Closed PartyDonut closed 18 hours ago

PartyDonut commented 19 hours ago

Pull Request Description

Possible unsanitized url for trickplays. Added the same logic to the sync provider

Issue Being Fixed

Resolves #116

Checklist

sourcery-ai[bot] commented 19 hours ago

Reviewer's Guide by Sourcery

This PR improves URL sanitization in two areas: the sync provider's download URL construction and the trickplay URL handling. The changes implement proper URL parsing and construction using Uri class instead of simple string concatenation, making the URL handling more robust and secure.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Refactored download URL construction in sync provider to use Uri class
  • Replaced string concatenation with Uri constructor for proper URL formatting
  • Added scheme detection (http/https) based on server URL
  • Implemented proper query parameter handling for api_key
  • Added explicit URL parsing for the final download string
lib/providers/sync_provider.dart
Enhanced trickplay URL processing with proper sanitization
  • Added URL sanitization for trickplay image lines
  • Improved filtering of empty lines and comments
  • Implemented proper URL parsing and string conversion for each line
  • Streamlined the processing chain using functional operations
lib/providers/service_provider.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#116 Fix the purple trickplay display issue caused by unsanitized URLs

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).