[PR #5188] [MERGED] Exclude BOM when writing meta.json plugin manifest #10423

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

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/5188
Author: @cvium
Created: 2/8/2021
Status: Merged
Merged: 2/8/2021
Merged by: @Bond-009

Base: masterHead: fix_manifest_bom


📝 Commits (1)

  • 311b2f5 Exclude BOM when writing meta.json plugin manifest

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 Emby.Server.Implementations/Plugins/PluginManager.cs (+1 -1)

📄 Description

This method uses UTF-8 encoding without a Byte-Order Mark (BOM), so using the GetPreamble method will return an empty byte array. If it is necessary to include a UTF-8 identifier, such as a byte order mark, at the beginning of a file, use the WriteAllText(String, String, Encoding) method overload with UTF8 encoding.

https://docs.microsoft.com/en-us/dotnet/api/system.io.file.writealltext?view=net-5.0#System_IO_File_WriteAllText_System_String_System_String_

TL;DR: BOM bad. JsonSerializer go boom. https://github.com/dotnet/runtime/issues/29838

Stack trace:

[15:10:52] [ERR] [1] Emby.Server.Implementations.Plugins.PluginManager: Error deserializing ?{
  "category": "",
  "changelog": "",
  "description": "",
  "guid": "4b9ed42f-5185-48b5-9803-6ff2989014c4",
  "name": "Open Subtitles",
  "overview": "",
  "owner": "",
  "targetAbi": "10.7.0.0",
  "timestamp": "0001-01-01T00:00:00.0000000Z",
  "version": "10.0.0.0",
  "status": "Active",
  "autoUpdate": false
}.
System.Text.Json.JsonException: '0xEF' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
 ---> System.Text.Json.JsonReaderException: '0xEF' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](ReadOnlySpan`1 utf8Json, JsonSerializerOptions options)
   at Emby.Server.Implementations.Plugins.PluginManager.LoadManifest(String dir) in C:\Users\claus\RiderProjects\jellyfin\Emby.Server.Implementations\Plugins\PluginManager.cs:line 534

🔄 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/5188 **Author:** [@cvium](https://github.com/cvium) **Created:** 2/8/2021 **Status:** ✅ Merged **Merged:** 2/8/2021 **Merged by:** [@Bond-009](https://github.com/Bond-009) **Base:** `master` ← **Head:** `fix_manifest_bom` --- ### 📝 Commits (1) - [`311b2f5`](https://github.com/jellyfin/jellyfin/commit/311b2f50122237d96fc93fc48c3658f4970de5a2) Exclude BOM when writing meta.json plugin manifest ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `Emby.Server.Implementations/Plugins/PluginManager.cs` (+1 -1) </details> ### 📄 Description > This method uses UTF-8 encoding without a Byte-Order Mark (BOM), so using the GetPreamble method will return an empty byte array. If it is necessary to include a UTF-8 identifier, such as a byte order mark, at the beginning of a file, use the WriteAllText(String, String, Encoding) method overload with UTF8 encoding. https://docs.microsoft.com/en-us/dotnet/api/system.io.file.writealltext?view=net-5.0#System_IO_File_WriteAllText_System_String_System_String_ TL;DR: BOM bad. JsonSerializer go boom. https://github.com/dotnet/runtime/issues/29838 Stack trace: ``` [15:10:52] [ERR] [1] Emby.Server.Implementations.Plugins.PluginManager: Error deserializing ?{ "category": "", "changelog": "", "description": "", "guid": "4b9ed42f-5185-48b5-9803-6ff2989014c4", "name": "Open Subtitles", "overview": "", "owner": "", "targetAbi": "10.7.0.0", "timestamp": "0001-01-01T00:00:00.0000000Z", "version": "10.0.0.0", "status": "Active", "autoUpdate": false }. System.Text.Json.JsonException: '0xEF' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0. ---> System.Text.Json.JsonReaderException: '0xEF' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0. at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex) at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Deserialize[TValue](ReadOnlySpan`1 utf8Json, JsonSerializerOptions options) at Emby.Server.Implementations.Plugins.PluginManager.LoadManifest(String dir) in C:\Users\claus\RiderProjects\jellyfin\Emby.Server.Implementations\Plugins\PluginManager.cs:line 534 ``` --- <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:20:04 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#10423