mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
[PR #5990] [MERGED] Enable querystring to be encoded #10763
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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:
master← Head:UrlDecoding📝 Commits (10+)
81d6759Enable automatic url decodinga7bccd4removed unneeded logger.dabeabccorrected commentsc8061f9slight format correction.4f5c9e9tests and small fix.af1fe1aMoved into test controller.043e69dUpdate tests/Jellyfin.Api.Tests/Controllers/EncodedQueryStringTest.cs5f70b4eUpdate tests/Jellyfin.Api.Tests/Controllers/EncodedQueryStringTest.cs5ad8b53Update Jellyfin.Api/Controllers/TestController.cs4c8cfaaUpdate 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.