diff --git a/src/Netclaw.Media.Tests/MimeTypeCatalogTests.cs b/src/Netclaw.Media.Tests/MimeTypeCatalogTests.cs index a09a63a13..990a8c61a 100644 --- a/src/Netclaw.Media.Tests/MimeTypeCatalogTests.cs +++ b/src/Netclaw.Media.Tests/MimeTypeCatalogTests.cs @@ -55,6 +55,7 @@ public void GetCategory_is_catalog_backed_not_prefix_backed(string mimeType, Att [InlineData(".png", MimeTypeCatalog.ImagePng)] [InlineData("jpg", MimeTypeCatalog.ImageJpeg)] [InlineData(".pdf", MimeTypeCatalog.ApplicationPdf)] + [InlineData(".potx", "application/vnd.openxmlformats-officedocument.presentationml.template")] [InlineData(".mp4", MimeTypeCatalog.VideoMp4)] [InlineData(".m4a", MimeTypeCatalog.AudioMp4)] public void FromExtension_returns_canonical_mime(string extension, string expected) diff --git a/src/Netclaw.Media/MimeTypeCatalog.cs b/src/Netclaw.Media/MimeTypeCatalog.cs index 14a9849c1..3ae833075 100644 --- a/src/Netclaw.Media/MimeTypeCatalog.cs +++ b/src/Netclaw.Media/MimeTypeCatalog.cs @@ -170,7 +170,7 @@ public static bool IsZipBackedOfficePath(string path) { return FileExtension.FromPath(path).Value switch { - ".docx" or ".xlsx" or ".pptx" or ".odt" or ".ods" or ".odp" => true, + ".docx" or ".xlsx" or ".pptx" or ".potx" or ".odt" or ".ods" or ".odp" => true, _ => false }; } @@ -212,6 +212,7 @@ private static MediaTypeDefinition[] BuildDefinitions() => Binary("application/vnd.openxmlformats-officedocument.wordprocessingml.document", AttachmentCategory.Document, MediaKind.Document, true, false, ".docx", ".docx"), Binary("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", AttachmentCategory.Document, MediaKind.Document, true, false, ".xlsx", ".xlsx"), Binary("application/vnd.openxmlformats-officedocument.presentationml.presentation", AttachmentCategory.Document, MediaKind.Document, true, false, ".pptx", ".pptx"), + Binary("application/vnd.openxmlformats-officedocument.presentationml.template", AttachmentCategory.Document, MediaKind.Document, true, false, ".potx", ".potx"), Binary("application/vnd.oasis.opendocument.text", AttachmentCategory.Document, MediaKind.Document, true, false, ".odt", ".odt"), Binary("application/vnd.oasis.opendocument.spreadsheet", AttachmentCategory.Document, MediaKind.Document, true, false, ".ods", ".ods"), Binary("application/vnd.oasis.opendocument.presentation", AttachmentCategory.Document, MediaKind.Document, true, false, ".odp", ".odp"), diff --git a/src/Netclaw.Security.Tests/MagicByteValidatorTests.cs b/src/Netclaw.Security.Tests/MagicByteValidatorTests.cs index c89371aab..186c93cbb 100644 --- a/src/Netclaw.Security.Tests/MagicByteValidatorTests.cs +++ b/src/Netclaw.Security.Tests/MagicByteValidatorTests.cs @@ -113,6 +113,7 @@ public void Validate_PdfMimeTypeMismatch(string headerField, string mime, string [InlineData(nameof(ZipHeader), "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "report.docx")] [InlineData(nameof(ZipHeader), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "budget.xlsx")] [InlineData(nameof(ZipHeader), "application/vnd.openxmlformats-officedocument.presentationml.presentation", "slides.pptx")] + [InlineData(nameof(ZipHeader), "application/vnd.openxmlformats-officedocument.presentationml.template", "master.potx")] [InlineData(nameof(ZipHeader), "application/vnd.oasis.opendocument.text", "notes.odt")] [InlineData(nameof(OleHeader), "application/msword", "legacy.doc")] [InlineData(nameof(OleHeader), "application/vnd.ms-excel", "legacy.xls")] diff --git a/src/Netclaw.Security/MagicByteValidator.cs b/src/Netclaw.Security/MagicByteValidator.cs index 89d10acfa..4fdbcb753 100644 --- a/src/Netclaw.Security/MagicByteValidator.cs +++ b/src/Netclaw.Security/MagicByteValidator.cs @@ -239,6 +239,7 @@ public static bool HasExecutableSignature(ReadOnlySpan content) ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] = IsZip, ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] = IsZip, ["application/vnd.openxmlformats-officedocument.presentationml.presentation"] = IsZip, + ["application/vnd.openxmlformats-officedocument.presentationml.template"] = IsZip, // OpenDocument (also ZIP-based) ["application/vnd.oasis.opendocument.text"] = IsZip,