[PR #5990] [MERGED] Enable querystring to be encoded #10763

Closed
opened 2026-02-07 06:26:14 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/5990
Author: @BaronGreenback
Created: 5/6/2021
Status: Merged
Merged: 6/8/2021
Merged by: @cvium

Base: masterHead: UrlDecoding


📝 Commits (10+)

  • 81d6759 Enable automatic url decoding
  • a7bccd4 removed unneeded logger.
  • dabeabc corrected comments
  • c8061f9 slight format correction.
  • 4f5c9e9 tests and small fix.
  • af1fe1a Moved into test controller.
  • 043e69d Update tests/Jellyfin.Api.Tests/Controllers/EncodedQueryStringTest.cs
  • 5f70b4e Update tests/Jellyfin.Api.Tests/Controllers/EncodedQueryStringTest.cs
  • 5ad8b53 Update Jellyfin.Api/Controllers/TestController.cs
  • 4c8cfaa Update Jellyfin.Api/Controllers/TestController.cs

📊 Changes

7 files changed (+199 additions, -0 deletions)

View changed files

📝 Jellyfin.Server/Extensions/ApiApplicationBuilderExtensions.cs (+10 -0)
Jellyfin.Server/Middleware/QueryStringDecodingMiddleware.cs (+35 -0)
Jellyfin.Server/Middleware/UrlDecodeQueryFeature.cs (+86 -0)
📝 Jellyfin.Server/Startup.cs (+1 -0)
📝 tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj (+1 -0)
tests/Jellyfin.Server.Integration.Tests/Controllers/EncoderController.cs (+33 -0)
tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs (+33 -0)

📄 Description

With this PR, url encoded querystrings can be used, and will be processed as normal.

This overcomes an issue inherent in the current DLNA implementation.

DLNA uses SOAP (which is based upon XML). Ampersands (&) present in URL's cause the XML to become invalid.
To overcome this, the JF (10.X -> 10.7.5) HtmlEncodes the url. (Strictly speaking, this isn't DLNA compliant, as URI's should be percent encoded.) It also doesn't work with all DLNA devices.

This PR uses middleware to decode any querystring where only 1 key exists without a value (this is how encoded querystrings are presented to Kestrel). From then on, it is treated as if the querystring was presented in the clear.

The solution others seem to use is to hard encode the parameters into the uri path. This isn't an option for us with the current implementation as we have numerous optional options.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/5990 **Author:** [@BaronGreenback](https://github.com/BaronGreenback) **Created:** 5/6/2021 **Status:** ✅ Merged **Merged:** 6/8/2021 **Merged by:** [@cvium](https://github.com/cvium) **Base:** `master` ← **Head:** `UrlDecoding` --- ### 📝 Commits (10+) - [`81d6759`](https://github.com/jellyfin/jellyfin/commit/81d675990f87586061bdce5d585dad28f7e181fa) Enable automatic url decoding - [`a7bccd4`](https://github.com/jellyfin/jellyfin/commit/a7bccd4fe0a1c046e335a91e85b8e806b50d58bc) removed unneeded logger. - [`dabeabc`](https://github.com/jellyfin/jellyfin/commit/dabeabc553afc4551356566f9184e6659f604cee) corrected comments - [`c8061f9`](https://github.com/jellyfin/jellyfin/commit/c8061f92bec0d1e12e2b57012c6c72c629374327) slight format correction. - [`4f5c9e9`](https://github.com/jellyfin/jellyfin/commit/4f5c9e95041a39ae549bfa3f36bbeda054bce3ca) tests and small fix. - [`af1fe1a`](https://github.com/jellyfin/jellyfin/commit/af1fe1af6fee7f4e5cf73d92266df21b291169d9) Moved into test controller. - [`043e69d`](https://github.com/jellyfin/jellyfin/commit/043e69d252d5862ec5466ad037fea05f5aaef40f) Update tests/Jellyfin.Api.Tests/Controllers/EncodedQueryStringTest.cs - [`5f70b4e`](https://github.com/jellyfin/jellyfin/commit/5f70b4ead16965acf4dbaf7bb486ecf072fb2a1b) Update tests/Jellyfin.Api.Tests/Controllers/EncodedQueryStringTest.cs - [`5ad8b53`](https://github.com/jellyfin/jellyfin/commit/5ad8b53f5d1a540453d897cddf924aa6fee46570) Update Jellyfin.Api/Controllers/TestController.cs - [`4c8cfaa`](https://github.com/jellyfin/jellyfin/commit/4c8cfaa61c513e51aab4440244a067ca39175dd5) Update Jellyfin.Api/Controllers/TestController.cs ### 📊 Changes **7 files changed** (+199 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `Jellyfin.Server/Extensions/ApiApplicationBuilderExtensions.cs` (+10 -0) ➕ `Jellyfin.Server/Middleware/QueryStringDecodingMiddleware.cs` (+35 -0) ➕ `Jellyfin.Server/Middleware/UrlDecodeQueryFeature.cs` (+86 -0) 📝 `Jellyfin.Server/Startup.cs` (+1 -0) 📝 `tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj` (+1 -0) ➕ `tests/Jellyfin.Server.Integration.Tests/Controllers/EncoderController.cs` (+33 -0) ➕ `tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs` (+33 -0) </details> ### 📄 Description With this PR, url encoded querystrings can be used, and will be processed as normal. This overcomes an issue inherent in the current DLNA implementation. DLNA uses SOAP (which is based upon XML). Ampersands (&) present in URL's cause the XML to become invalid. To overcome this, the JF (10.X -> 10.7.5) HtmlEncodes the url. (Strictly speaking, this isn't DLNA compliant, as URI's should be percent encoded.) It also doesn't work with all DLNA devices. This PR uses middleware to decode any querystring where only 1 key exists without a value (this is how encoded querystrings are presented to Kestrel). From then on, it is treated as if the querystring was presented in the clear. The solution others seem to use is to hard encode the parameters into the uri path. This isn't an option for us with the current implementation as we have numerous optional options. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 06:26:14 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#10763