Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

feat(archives): recognize Workbench ZIP archives with WBPZ extension

Mustafa1pe32bcfbce4b5
diff --git a/README.md b/README.md
index ab0572ab..c8544d4e 100644
--- a/README.md
+++ b/README.md
@@ -102,7 +102,7 @@ Filee shows new releases in its menu and updates itself, keeping your settings a
| **Video**⁵: MP4, MOV, MKV, WEBM, AVI, WMV, FLV, MPEG (including Video CD DAT), TS, M2TS, 3GP, OGV, VOB, … | MP4 (H.264, HEVC, AV1), WEBM, MOV, MKV, AVI, GIF, APNG, MP3, M4A, 720p, subtitles (SRT, ASS, WebVTT) |
| **Audio**⁵: MP3, M4A, AAC, WAV, FLAC, OGG, OPUS, WMA, AIFF, AMR, APE, WavPack, TTA, DSD (DSF, DFF), DTS, AC3, E-AC3, … | MP3, M4A (AAC, ALAC), WAV, FLAC, OGG, OPUS, AAC, WavPack, TTA, W64, AC3, E-AC3 |
| **Subtitles**: SRT, ASS/SSA, WebVTT, SAMI (SMI), LRC, TTML, MicroDVD, SCC | each other as UTF-8 (Korean CP949 files read correctly) |
-| **Archives**: ZIP, 7Z, RAR, TAR, TAR.GZ, TAR.BZ2, TAR.XZ, GZ, ISO, CAB, DMG, ALZ, EGG, … | extract, ZIP, 7Z, TAR, TAR.GZ; any files → one ZIP |
+| **Archives**: ZIP (including ANSYS Workbench WBPZ), 7Z, RAR, TAR, TAR.GZ, TAR.BZ2, TAR.XZ, GZ, ISO, CAB, DMG, ALZ, EGG, … | extract, ZIP, 7Z, TAR, TAR.GZ; any files → one ZIP |
| **CAD**: DWG, DXF | PDF, SVG, PNG, DWG ↔ DXF |
| **Fonts**: TTF, OTF, WOFF, WOFF2, EOT | each other |
| **Data**: JSON, JSON Lines, YAML, TOML, XML · vCard | each other, CSV and XLSX (tables); vCard ↔ CSV |
diff --git a/docs/ENGINES.md b/docs/ENGINES.md
index ce1c20f1..705ea5d3 100644
--- a/docs/ENGINES.md
+++ b/docs/ENGINES.md
@@ -28,7 +28,7 @@ Filee chooses engines automatically. Settings → *Engines* shows their status,
| 3D models (SharpGLTF for glTF) | built in (library) | **GLB, glTF, STL, OBJ (+ MTL), 3MF, PLY ↔ each other**; FBX → each of them; → PNG, JPG, … (an isometric preview) |
| **Geospatial vector data** | built in | **GeoJSON, KML, KMZ, GPX, Shapefile ↔ each other and CSV** (longitude / latitude or WKT); projected Shapefiles (UTM, Web Mercator, Lambert, Albers) are converted to WGS 84; through CSV to XLSX, JSON, … (see below) |
| rhwp | bundled with the installer (`engines/rhwp`, with the Microsoft C++ runtime, see below) | HWP/HWPX → PDF, **HWP → HWPX, HWPX → HWP** |
-| Archives (7-Zip) | bundled with the installer (`engines/7zip`, ~2.5 MB) + built-in readers | ZIP, 7Z, RAR, TAR (+ GZ/BZ2/XZ/Z/7Z/LZ), CAB, ISO, DMG, … **→ folder, ZIP, 7Z, TAR, TAR.GZ/BZ2/XZ**; ALZ, EGG, lzip read in-process; "Compress into one archive" for any files |
+| Archives (7-Zip) | bundled with the installer (`engines/7zip`, ~2.5 MB) + built-in readers | ZIP (including ANSYS Workbench WBPZ), 7Z, RAR, TAR (+ GZ/BZ2/XZ/Z/7Z/LZ), CAB, ISO, DMG, … **→ folder, ZIP, 7Z, TAR, TAR.GZ/BZ2/XZ**; ALZ, EGG, lzip read in-process; "Compress into one archive" for any files |
| LibreOffice + H2Orestart + Java | **optional download** (~420 MB, 1.3 GB on disk) | older and rare formats only: DOC, XLS, PPT, RTF and OpenDocument → PDF and to each other, output as DOCX/ODT/ODS/ODP; HWP/HWPX → DOCX/ODT; read-only formats (see below) → PDF and their kind's editable formats; FODT, OpenDocument templates (OTT, OTS, OTP) and XLT out; SVG → EMF/WMF/ODG, a PDF page → SVG |
| Pandoc | **optional download** (~42 MB, 240 MB on disk) | Markdown ↔ DOCX/ODT/RTF, DOCX/ODT/HTML/RTF → Markdown, HTML ↔ DOCX/ODT, markup languages (reStructuredText, LaTeX, Org, AsciiDoc, Typst, MediaWiki, DocBook, Jupyter, Textile, man, OPML) ↔ Markdown/HTML/DOCX/ODT and each other (and → RTF, EPUB, TXT), Markdown and markup → PPTX slides |
| Ghostscript | **optional download** (~20 MB, 31 MB on disk) | EPS/PS → PDF, PDF → EPS/PS, PostScript-based AI → PDF (images through PDF and PDFium); smaller PDFs when a preset asks for it |
@@ -1098,7 +1098,7 @@ bundled with the installer), never a 7-Zip installed on the PC. It runs as a sep
| Format | Read | Write |
|---|---|---|
-| ZIP, JAR | 7-Zip | ZIP in-process (System.IO.Compression): UTF-8 names with the language-encoding flag, times, empty folders |
+| ZIP, JAR, WBPZ | 7-Zip | ZIP in-process (System.IO.Compression): UTF-8 names with the language-encoding flag, times, empty folders |
| 7Z | 7-Zip | 7-Zip |
| TAR | 7-Zip | in-process (System.Formats.Tar, PAX: UTF-8 names, times) |
| TAR.GZ | 7-Zip, in two stages | in-process (PAX TAR + GZipStream) |
diff --git a/src/Filee.Core/Formats/FormatRegistry.cs b/src/Filee.Core/Formats/FormatRegistry.cs
index efaecebc..1ec46736 100644
--- a/src/Filee.Core/Formats/FormatRegistry.cs
+++ b/src/Filee.Core/Formats/FormatRegistry.cs
@@ -248,7 +248,8 @@ public static class FormatRegistry
new("spx", "Speex", FormatCategory.Audio, ["spx"], Writable: false),
// Archives
- new("zip", "ZIP", FormatCategory.Archive, ["zip"]),
+ // ANSYS Workbench project archives use the ZIP container (issue #294).
+ new("zip", "ZIP", FormatCategory.Archive, ["zip", "wbpz"]),
new("7z", "7Z", FormatCategory.Archive, ["7z"]),
new("rar", "RAR", FormatCategory.Archive, ["rar"], Writable: false),
new("tar", "TAR", FormatCategory.Archive, ["tar"]),
diff --git a/src/Filee.Core/Settings/UserDataStore.cs b/src/Filee.Core/Settings/UserDataStore.cs
index 9c9f3467..1e21c611 100644
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@ -715,9 +715,9 @@ internal static class SettingsMigrations
// back. One the user emptied is saved empty and stays so.
if (from < 30 || profiles.Any(p => p.BackPresetIds is null))
changed |= AddBackFaces(presets, profiles);
- // v31: text logs/source/proxy scripts and Video CD DAT files learn their donuts; custom claims stay put.
+ // v31: source text, Video CD DAT and Workbench archives learn their donuts; custom claims stay put.
if (from < 31)
- changed |= LearnExtensions(profiles, out _, ["log", "py", "pac", "bat", "command", "dat"]);
+ changed |= LearnExtensions(profiles, out _, ["log", "py", "pac", "bat", "command", "dat", "wbpz"]);
return changed;
}
diff --git a/tests/Filee.Core.Tests/UserDataStoreTests.cs b/tests/Filee.Core.Tests/UserDataStoreTests.cs
index 40836949..9d93dd9c 100644
--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs
+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs
@@ -14,7 +14,7 @@ public class UserDataStoreTests
store.Load();
store.Settings.SchemaVersion = 30;
foreach (var profile in store.Profiles)
- profile.Extensions.RemoveAll(e => e is "log" or "py" or "pac" or "bat" or "command" or "dat");
+ profile.Extensions.RemoveAll(e => e is "log" or "py" or "pac" or "bat" or "command" or "dat" or "wbpz");
store.Profiles.Insert(0, new ToolbarProfile { Id = "my-python", Name = "My code", Extensions = ["py"] });
store.SaveLibrary();
store.SaveSettings();
@@ -29,6 +29,7 @@ public class UserDataStoreTests
Assert.DoesNotContain("py", text.Extensions);
Assert.Contains("py", upgraded.Profiles.Single(p => p.Id == "my-python").Extensions);
Assert.Contains("dat", upgraded.Profiles.Single(p => p.Id == "video").Extensions);
+ Assert.Contains("wbpz", upgraded.Profiles.Single(p => p.Id == "archives").Extensions);
var reloaded = new UserDataStore(dir.Path);
reloaded.Load();
diff --git a/tests/Filee.Engines.Tests/ReportedIssueTests.cs b/tests/Filee.Engines.Tests/ReportedIssueTests.cs
index b6ab6b65..39e9d1f3 100644
--- a/tests/Filee.Engines.Tests/ReportedIssueTests.cs
+++ b/tests/Filee.Engines.Tests/ReportedIssueTests.cs
@@ -1,5 +1,8 @@
// End-to-end regressions from the public issue audit: real converters and files, checked after conversion.
+using System.IO.Compression;
+using System.Security.Cryptography;
+using System.Text;
using Filee.Core.Conversion;
using Filee.Core.Formats;
using Filee.Core.Presets;
@@ -12,6 +15,56 @@ namespace Filee.Engines.Tests;
public class ReportedIssueTests(EngineFixture fx) : IClassFixture<EngineFixture>
{
+ [Fact]
+ public async Task Issue294_workbench_zip_archive_keeps_every_payload_when_exported_as_zip()
+ {
+ Assert.SkipUnless(fx.Catalog.StatusOf(fx.Converters.Single(c => c.Id == "archive")).IsAvailable,
+ "7-Zip is needed for archive reading.");
+ var input = Path.Combine(fx.NewFolder(), "project.wbpz");
+ var expected = new Dictionary<string, byte[]>
+ {
+ ["project.wbpj"] = Encoding.UTF8.GetBytes("<?xml version=\"1.0\"?><Project name=\"Archive payload\"/>"),
+ ["project_files/dp0/SYS/MECH/model.dat"] = Enumerable.Range(0, 256).Select(i => (byte)i).ToArray(),
+ ["user_files/ملاحظات.txt"] = Encoding.UTF8.GetBytes("مرحبا 中文 שלום\n"),
+ };
+ using (var archive = ZipFile.Open(input, ZipArchiveMode.Create))
+ {
+ foreach (var (name, bytes) in expected)
+ {
+ using var entry = archive.CreateEntry(name).Open();
+ entry.Write(bytes);
+ }
+ archive.CreateEntry("project_files/empty/");
+ }
+ var before = SHA256.HashData(await File.ReadAllBytesAsync(input, TestContext.Current.CancellationToken));
+ var job = await fx.ConvertAsync([input], new Preset { TargetFormat = "zip" });
+ Assert.Equal(JobState.Completed, job.State);
+ using var output = ZipFile.OpenRead(Assert.Single(job.Outputs));
+ Assert.Equal(expected.Keys.Order(), output.Entries.Where(e => !e.FullName.EndsWith('/')).Select(e => e.FullName).Order());
+ foreach (var (name, bytes) in expected)
+ {
+ using var entry = output.GetEntry(name)!.Open();
+ using var data = new MemoryStream();
+ await entry.CopyToAsync(data, TestContext.Current.CancellationToken);
+ Assert.Equal(bytes, data.ToArray());
+ }
+ Assert.NotNull(output.GetEntry("project_files/empty/"));
+ Assert.Equal(before, SHA256.HashData(await File.ReadAllBytesAsync(input, TestContext.Current.CancellationToken)));
+ }
+
+ [Fact]
+ public async Task Issue294_a_non_archive_wbpz_is_refused_without_a_claimed_zip_result()
+ {
+ Assert.SkipUnless(fx.Catalog.StatusOf(fx.Converters.Single(c => c.Id == "archive")).IsAvailable,
+ "7-Zip is needed for archive validation.");
+ var input = Path.Combine(fx.NewFolder(), "invalid.wbpz");
+ await File.WriteAllTextAsync(input, "This is not an archive.", TestContext.Current.CancellationToken);
+ var job = await fx.ConvertAsync([input], new Preset { TargetFormat = "zip" });
+ Assert.Equal(JobState.Failed, job.State);
+ Assert.Empty(job.Outputs);
+ Assert.Equal("This is not an archive.", await File.ReadAllTextAsync(input, TestContext.Current.CancellationToken));
+ }
+
[Theory]
[InlineData("mp4")]
[InlineData("mkv")]