From f13a9c5128d9421055c88be0d817a7c3e7037836 Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Tue, 15 Oct 2024 09:15:37 -0400 Subject: [PATCH] EBML: Retain companion tag --- lofty/src/ebml/tag/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lofty/src/ebml/tag/mod.rs b/lofty/src/ebml/tag/mod.rs index bffc4783..3ccc499c 100644 --- a/lofty/src/ebml/tag/mod.rs +++ b/lofty/src/ebml/tag/mod.rs @@ -13,10 +13,11 @@ pub use tag::*; pub use tag_name::*; pub use target::*; -use crate::config::WriteOptions; +use crate::config::{global_options, WriteOptions}; use crate::error::LoftyError; use crate::io::{FileLike, Length, Truncate}; use crate::picture::Picture; +use crate::tag::companion_tag::CompanionTag; use crate::tag::{Accessor, MergeTag, SplitTag, TagExt, TagType}; use std::borrow::Cow; @@ -373,7 +374,13 @@ impl MergeTag for SplitTagRemainder { impl From for crate::tag::Tag { fn from(input: MatroskaTag) -> Self { - input.split_tag().1 + let (remainder, mut tag) = input.split_tag(); + + if unsafe { global_options().preserve_format_specific_items } && remainder.0.len() > 0 { + tag.companion_tag = Some(CompanionTag::Matroska(remainder.0)); + } + + tag } }