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(formats): export script source and convert Video CD DAT files

Mustafa1paaedb25de6ff
diff --git a/docs/ENGINES.md b/docs/ENGINES.md
index 9f630959..ce1c20f1 100644
--- a/docs/ENGINES.md
+++ b/docs/ENGINES.md
@@ -12,7 +12,7 @@ Filee chooses engines automatically. Settings → *Engines* shows their status,
| PDFsharp | built in (library) | images → PDF, merge, split, page ranges, **compression** (smaller PDFs, see below) |
| PDFium | built in (library) | PDF → images (multi-page TIFF/GIF supported) |
| Unhwp | built in (library) | HWP/HWPX → TXT, Markdown, HTML (pictures in a `<name>_files` folder next to the Markdown, embedded in the HTML) |
-| Markdown (Markdig) | built in (library) | **Markdown → HTML, TXT** (and → PDF / DOCX through the HWPX writer, rhwp or LibreOffice) |
+| Text & Markdown (Markdig) | built in (library) | **Markdown → HTML, TXT**; **TXT, LOG, PY, PAC, BAT, COMMAND → UTF-8 TXT**, preserving source text without running scripts (and → PDF / DOCX through the HWPX writer, rhwp or LibreOffice) |
| Spreadsheets (ExcelDataReader for XLS) | built in (library) | **XLSX, XLS, ODS, CSV, TSV → XLSX, ODS, CSV, TSV** (one CSV / TSV per sheet) |
| Office Open XML | built in | **DOCM / DOTX / DOTM ↔ DOCX, XLSM / XLTX ↔ XLSX, PPTM / POTX / POTM / PPSX ↔ PPTX** (macros removed for macro-free types) |
| Fonts | built in | **TTF, OTF, WOFF, WOFF2, EOT ↔ each other**; CFF (PostScript) outlines become TrueType for TTF and EOT |
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index eb2bae6c..31b63ae7 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -119,7 +119,7 @@
"engine.pdfsharp.description": "Makes PDFs from images and merges, splits or cuts page ranges out of PDFs.\nAlso makes PDFs smaller by scaling down their pictures.",
"engine.rhwp.description": "Renders HWP/HWPX to PDF and converts HWP ↔ HWPX.\nIt also draws documents that reach PDF through HWPX (DOCX, XLSX, PPTX, e-books…).",
"engine.unhwp.description": "Extracts text, Markdown and HTML from HWP and HWPX.",
- "engine.markdown.description": "Markdown → HTML and plain text.",
+ "engine.markdown.description": "Markdown → HTML and plain text.\nText and script source files → UTF-8 TXT, without running scripts.",
"engine.spreadsheet.description": "XLSX, XLS, ODS, CSV and TSV into each other (XLS is read only).\nOne CSV per sheet.",
"engine.ooxml.description": "Macro-enabled files and templates (DOCM, XLSM, PPTM, DOTX…) ↔ DOCX, XLSX, PPTX.\nMacros are removed.",
"engine.hwpx-writer.description": "Writes HWPX from Word, Excel, PowerPoint, PDF, OFD, HTML, e-books and Markdown.\nThe first step of turning documents into PDF without Office.",
@@ -187,6 +187,9 @@
"preset.flip_horizontal.short": "Horizontal",
"preset.flip_vertical": "Flip vertical",
"preset.flip_vertical.short": "Vertical",
+ "merge.order_title": "Choose merge order",
+ "merge.order_hint": "Select a file and move it up or down. Files are merged from top to bottom. (Alt+↑ / Alt+↓)",
+
"preset.merge_pdf": "Merge PDF",
"preset.split_pdf": "Split PDF",
"preset.compress_pdf": "Compress PDF",
diff --git a/src/Filee.App/Assets/i18n/es.json b/src/Filee.App/Assets/i18n/es.json
index 04ccec81..b7fcced1 100644
--- a/src/Filee.App/Assets/i18n/es.json
+++ b/src/Filee.App/Assets/i18n/es.json
@@ -112,7 +112,7 @@
"engine.pdfsharp.description": "Crea PDF a partir de imágenes y combina, divide o extrae rangos de páginas de PDF.\nTambién reduce el tamaño de los PDF reduciendo sus imágenes.",
"engine.rhwp.description": "Renderiza HWP/HWPX a PDF y convierte HWP ↔ HWPX.\nTambién dibuja en PDF los documentos que llegan a PDF a través de HWPX (DOCX, XLSX, PPTX, libros electrónicos…).",
"engine.unhwp.description": "Extrae texto, Markdown y HTML de HWP y HWPX.",
- "engine.markdown.description": "Markdown → HTML y texto sin formato.",
+ "engine.markdown.description": "Markdown → HTML y texto sin formato.\nArchivos de texto y código fuente de scripts → TXT en UTF-8, sin ejecutar scripts.",
"engine.spreadsheet.description": "XLSX, XLS, ODS, CSV y TSV entre sí (XLS es de solo lectura).\nUn CSV por hoja.",
"engine.ooxml.description": "Archivos y plantillas con macros (DOCM, XLSM, PPTM, DOTX…) ↔ DOCX, XLSX, PPTX.\nLas macros se eliminan.",
"engine.hwpx-writer.description": "Escribe HWPX desde Word, Excel, PowerPoint, PDF, OFD, HTML, libros electrónicos y Markdown.\nEl primer paso para pasar documentos a PDF sin Office.",
@@ -177,6 +177,9 @@
"preset.flip_horizontal.short": "Horizontal",
"preset.flip_vertical": "Volteo vertical",
"preset.flip_vertical.short": "Vertical",
+ "merge.order_title": "Elegir el orden de combinación",
+ "merge.order_hint": "Selecciona un archivo y muévelo arriba o abajo. Los archivos se combinan de arriba abajo. (Alt+↑ / Alt+↓)",
+
"preset.merge_pdf": "Combinar PDF",
"preset.split_pdf": "Dividir PDF",
"preset.compress_pdf": "Comprimir PDF",
diff --git a/src/Filee.App/Assets/i18n/hi.json b/src/Filee.App/Assets/i18n/hi.json
index 96147549..5a075dee 100644
--- a/src/Filee.App/Assets/i18n/hi.json
+++ b/src/Filee.App/Assets/i18n/hi.json
@@ -112,7 +112,7 @@
"engine.pdfsharp.description": "इमेज से PDF बनाता है और PDF को मर्ज करता है, बाँटता है या उनमें से पेज रेंज काटता है।\nPDF की तस्वीरों का आकार घटाकर उन्हें छोटा भी करता है।",
"engine.rhwp.description": "HWP/HWPX को PDF में रेंडर करता है और HWP ↔ HWPX कन्वर्ट करता है।\nयह उन दस्तावेज़ों को भी बनाता है जो HWPX के रास्ते PDF तक पहुँचते हैं (DOCX, XLSX, PPTX, ई-बुक…)।",
"engine.unhwp.description": "HWP और HWPX से टेक्स्ट, Markdown और HTML निकालता है।",
- "engine.markdown.description": "Markdown → HTML और सादा टेक्स्ट।",
+ "engine.markdown.description": "Markdown → HTML और सादा टेक्स्ट।\nटेक्स्ट और स्क्रिप्ट की सोर्स फ़ाइलें → UTF-8 TXT, स्क्रिप्ट चलाए बिना।",
"engine.spreadsheet.description": "XLSX, XLS, ODS, CSV और TSV एक-दूसरे में (XLS केवल पढ़ा जा सकता है)।\nहर शीट के लिए एक CSV।",
"engine.ooxml.description": "मैक्रो-सक्षम फ़ाइलें और टेम्पलेट (DOCM, XLSM, PPTM, DOTX…) ↔ DOCX, XLSX, PPTX।\nमैक्रो हटा दिए जाते हैं।",
"engine.hwpx-writer.description": "Word, Excel, PowerPoint, PDF, OFD, HTML, ई-बुक और Markdown से HWPX लिखता है।\nOffice के बिना दस्तावेज़ों को PDF में बदलने का पहला चरण।",
@@ -177,6 +177,9 @@
"preset.flip_horizontal.short": "आड़ा",
"preset.flip_vertical": "खड़ा पलटें",
"preset.flip_vertical.short": "खड़ा",
+ "merge.order_title": "मर्ज करने का क्रम चुनें",
+ "merge.order_hint": "फ़ाइल चुनकर उसे ऊपर या नीचे ले जाएँ। फ़ाइलें ऊपर से नीचे के क्रम में मर्ज होंगी। (Alt+↑ / Alt+↓)",
+
"preset.merge_pdf": "PDF मर्ज करें",
"preset.split_pdf": "PDF बाँटें",
"preset.compress_pdf": "PDF कंप्रेस करें",
diff --git a/src/Filee.App/Assets/i18n/ja.json b/src/Filee.App/Assets/i18n/ja.json
index d410f937..dc6c6483 100644
--- a/src/Filee.App/Assets/i18n/ja.json
+++ b/src/Filee.App/Assets/i18n/ja.json
@@ -112,7 +112,7 @@
"engine.pdfsharp.description": "画像からPDFを作成し、PDFの結合、分割、ページ範囲の切り出しを行います。\n画像を縮小してPDFのファイルサイズを小さくすることもできます。",
"engine.rhwp.description": "HWP/HWPXをPDFに変換し、HWPとHWPXを相互変換します。\nHWPXを経由してPDFにする文書(DOCX、XLSX、PPTX、電子書籍など)の描画にも使われます。",
"engine.unhwp.description": "HWPとHWPXからテキスト、Markdown、HTMLを抽出します。",
- "engine.markdown.description": "MarkdownをHTMLまたはプレーンテキストに変換します。",
+ "engine.markdown.description": "MarkdownをHTMLまたはプレーンテキストに変換します。\nテキストとスクリプトのソースファイル → UTF-8 TXT。スクリプトは実行しません。",
"engine.spreadsheet.description": "XLSX、XLS、ODS、CSV、TSVを相互変換します(XLSは読み込みのみ)。\nシートごとにCSVを1つ作成します。",
"engine.ooxml.description": "マクロ有効ファイルやテンプレート(DOCM、XLSM、PPTM、DOTXなど)をDOCX、XLSX、PPTXと相互変換します。\nマクロは削除されます。",
"engine.hwpx-writer.description": "Word、Excel、PowerPoint、PDF、OFD、HTML、電子書籍、MarkdownからHWPXを作成します。\nOfficeを使わずに文書をPDFにする際の最初の変換段階です。",
@@ -177,6 +177,9 @@
"preset.flip_horizontal.short": "水平",
"preset.flip_vertical": "垂直方向に反転",
"preset.flip_vertical.short": "垂直",
+ "merge.order_title": "結合順序を選択",
+ "merge.order_hint": "ファイルを選択して上下に移動します。上から順に結合されます。(Alt+↑ / Alt+↓)",
+
"preset.merge_pdf": "結合",
"preset.split_pdf": "分割",
"preset.compress_pdf": "圧縮",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 624041ab..17f66a8b 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -119,7 +119,7 @@
"engine.pdfsharp.description": "이미지로 PDF를 만들고, PDF를 합치거나 나누거나 원하는 페이지만 잘라내요.\nPDF 속 이미지를 줄여 파일을 작게 만들기도 해요.",
"engine.rhwp.description": "HWP/HWPX를 PDF로 그리고, HWP ↔ HWPX를 바꿔요.\nHWPX를 거쳐 PDF가 되는 문서(DOCX, XLSX, PPTX, 전자책 등)도 그려요.",
"engine.unhwp.description": "HWP와 HWPX에서 텍스트, 마크다운, HTML을 뽑아내요.",
- "engine.markdown.description": "마크다운 → HTML, 텍스트.",
+ "engine.markdown.description": "마크다운 → HTML, 텍스트.\n텍스트 및 스크립트 소스 파일 → UTF-8 TXT. 스크립트는 실행하지 않습니다.",
"engine.spreadsheet.description": "XLSX, XLS, ODS, CSV, TSV를 서로 바꿔요(XLS는 읽기만).\nCSV는 시트마다 하나씩 만들어요.",
"engine.ooxml.description": "매크로·서식 파일(DOCM, XLSM, PPTM, DOTX 등) ↔ DOCX, XLSX, PPTX.\n매크로는 지워요.",
"engine.hwpx-writer.description": "워드, 엑셀, 파워포인트, PDF, OFD, HTML, 전자책, 마크다운을 HWPX로 써요.\n오피스 없이 문서를 PDF로 바꾸는 첫 단계예요.",
@@ -187,6 +187,9 @@
"preset.flip_horizontal.short": "좌우",
"preset.flip_vertical": "상하 반전",
"preset.flip_vertical.short": "상하",
+ "merge.order_title": "병합 순서 선택",
+ "merge.order_hint": "파일을 선택해 위아래로 이동하세요. 위에서 아래 순서로 병합됩니다. (Alt+↑ / Alt+↓)",
+
"preset.merge_pdf": "PDF 병합",
"preset.split_pdf": "PDF 분할",
"preset.compress_pdf": "PDF 압축",
diff --git a/src/Filee.App/Assets/i18n/pl.json b/src/Filee.App/Assets/i18n/pl.json
index eeae1029..1e43e19e 100644
--- a/src/Filee.App/Assets/i18n/pl.json
+++ b/src/Filee.App/Assets/i18n/pl.json
@@ -119,7 +119,7 @@
"engine.pdfsharp.description": "Tworzy PDF z obrazów oraz łączy, dzieli i wycina zakresy stron z plików PDF.",
"engine.rhwp.description": "Renderuje HWP/HWPX do PDF i konwertuje HWP ↔ HWPX.\nRysuje też dokumenty, które trafiają do PDF przez HWPX (DOCX, XLSX, PPTX, e-booki…).",
"engine.unhwp.description": "Wyodrębnia tekst, Markdown i HTML z HWP i HWPX.",
- "engine.markdown.description": "Markdown → HTML i zwykły tekst.",
+ "engine.markdown.description": "Markdown → HTML i zwykły tekst.\nPliki tekstowe i źródła skryptów → TXT w UTF-8, bez uruchamiania skryptów.",
"engine.spreadsheet.description": "XLSX, XLS, ODS, CSV i TSV między sobą (XLS tylko do odczytu).\nJeden CSV na arkusz.",
"engine.ooxml.description": "Pliki z makrami i szablony (DOCM, XLSM, PPTM, DOTX…) ↔ DOCX, XLSX, PPTX.\nMakra są usuwane.",
"engine.hwpx-writer.description": "Zapisuje HWPX z Worda, Excela, PowerPointa, PDF, OFD, HTML, e-booków i Markdown.\nPierwszy krok zamiany dokumentów na PDF bez Office.",
@@ -187,6 +187,9 @@
"preset.flip_horizontal.short": "Poziomo",
"preset.flip_vertical": "Odbij w pionie",
"preset.flip_vertical.short": "Pionowo",
+ "merge.order_title": "Wybierz kolejność scalania",
+ "merge.order_hint": "Wybierz plik i przesuń go w górę lub w dół. Pliki są scalane od góry do dołu. (Alt+↑ / Alt+↓)",
+
"preset.merge_pdf": "Połącz PDF",
"preset.split_pdf": "Podziel PDF",
"preset.compress_pdf": "Kompresuj PDF",
diff --git a/src/Filee.App/Assets/i18n/ru.json b/src/Filee.App/Assets/i18n/ru.json
index 3ece7aea..ca3eaa7f 100644
--- a/src/Filee.App/Assets/i18n/ru.json
+++ b/src/Filee.App/Assets/i18n/ru.json
@@ -119,7 +119,7 @@
"engine.pdfsharp.description": "Делает PDF из картинок, объединяет и разделяет PDF, вырезает диапазоны страниц.\nА ещё уменьшает PDF, сжимая картинки внутри.",
"engine.rhwp.description": "Превращает HWP/HWPX в PDF и конвертирует HWP ↔ HWPX.\nОн же отрисовывает документы, которые идут в PDF через HWPX (DOCX, XLSX, PPTX, электронные книги…).",
"engine.unhwp.description": "Достаёт текст, Markdown и HTML из HWP и HWPX.",
- "engine.markdown.description": "Markdown → HTML и простой текст.",
+ "engine.markdown.description": "Markdown → HTML и простой текст.\nТекстовые файлы и исходники скриптов → TXT в UTF-8 без выполнения скриптов.",
"engine.spreadsheet.description": "XLSX, XLS, ODS, CSV и TSV друг в друга (XLS — только чтение).\nПо одному CSV на лист.",
"engine.ooxml.description": "Файлы с макросами и шаблоны (DOCM, XLSM, PPTM, DOTX…) ↔ DOCX, XLSX, PPTX.\nМакросы удаляются.",
"engine.hwpx-writer.description": "Создаёт HWPX из Word, Excel, PowerPoint, PDF, OFD, HTML, электронных книг и Markdown.\nПервый шаг, чтобы получить PDF из документов без Office.",
@@ -187,6 +187,9 @@
"preset.flip_horizontal.short": "По гориз.",
"preset.flip_vertical": "Отразить по вертикали",
"preset.flip_vertical.short": "По верт.",
+ "merge.order_title": "Выберите порядок объединения",
+ "merge.order_hint": "Выберите файл и переместите его вверх или вниз. Файлы объединяются сверху вниз. (Alt+↑ / Alt+↓)",
+
"preset.merge_pdf": "Объединить PDF",
"preset.split_pdf": "Разделить PDF",
"preset.compress_pdf": "Сжать PDF",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index 4792a256..18e3fe96 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -119,7 +119,7 @@
"engine.pdfsharp.description": "用图片生成 PDF,合并、拆分 PDF 或截取指定页码。\n还能缩小 PDF 中的图片来减小文件。",
"engine.rhwp.description": "将 HWP/HWPX 渲染为 PDF,并在 HWP ↔ HWPX 之间转换。\n经 HWPX 转为 PDF 的文档(DOCX、XLSX、PPTX、电子书等)也由它渲染。",
"engine.unhwp.description": "从 HWP 和 HWPX 中提取文本、Markdown 和 HTML。",
- "engine.markdown.description": "Markdown → HTML 和纯文本。",
+ "engine.markdown.description": "Markdown → HTML 和纯文本。\n文本和脚本源文件 → UTF-8 TXT,不会执行脚本。",
"engine.spreadsheet.description": "XLSX、XLS、ODS、CSV、TSV 互相转换(XLS 仅读取)。\n每个工作表生成一个 CSV。",
"engine.ooxml.description": "启用宏的文件和模板(DOCM、XLSM、PPTM、DOTX 等)↔ DOCX、XLSX、PPTX。\n转换时移除宏。",
"engine.hwpx-writer.description": "把 Word、Excel、PowerPoint、PDF、OFD、HTML、电子书和 Markdown 写成 HWPX。\n这是不用 Office 把文档转为 PDF 的第一步。",
@@ -187,6 +187,9 @@
"preset.flip_horizontal.short": "水平",
"preset.flip_vertical": "垂直翻转",
"preset.flip_vertical.short": "垂直",
+ "merge.order_title": "选择合并顺序",
+ "merge.order_hint": "选择文件并上下移动。文件将按从上到下的顺序合并。(Alt+↑ / Alt+↓)",
+
"preset.merge_pdf": "合并 PDF",
"preset.split_pdf": "拆分 PDF",
"preset.compress_pdf": "压缩 PDF",
diff --git a/src/Filee.Core/Formats/FormatRegistry.cs b/src/Filee.Core/Formats/FormatRegistry.cs
index 16083446..efaecebc 100644
--- a/src/Filee.Core/Formats/FormatRegistry.cs
+++ b/src/Filee.Core/Formats/FormatRegistry.cs
@@ -134,7 +134,8 @@ public static class FormatRegistry
new("sda", "SDA", FormatCategory.Presentation, ["sda", "sdd"], Writable: false),
// Plain text / markup
- new("txt", "TXT", FormatCategory.Text, ["txt"]),
+ // Text logs and source/proxy scripts are read as plain text, never executed (issues #273, #284, #254).
+ new("txt", "TXT", FormatCategory.Text, ["txt", "log", "py", "pac", "bat", "command"]),
new("md", "Markdown", FormatCategory.Text, ["md", "markdown"]),
new("html", "HTML", FormatCategory.Text, ["html", "htm", "xhtml"]),
// A web page saved with its pictures in one MIME file (Chrome, Edge, Word); read as the page it holds.
@@ -198,7 +199,8 @@ public static class FormatRegistry
new("avi", "AVI", FormatCategory.Video, ["avi", "divx"]),
new("wmv", "WMV", FormatCategory.Video, ["wmv", "asf"]),
new("flv", "FLV", FormatCategory.Video, ["flv", "f4v"]),
- new("mpg", "MPEG", FormatCategory.Video, ["mpg", "mpeg", "mpe", "m1v", "m2v"]),
+ // Video CD streams use .dat (issue #292). FFmpeg probes the contents; unrelated DAT data is rejected.
+ new("mpg", "MPEG", FormatCategory.Video, ["mpg", "mpeg", "mpe", "m1v", "m2v", "dat"]),
new("ts", "TS", FormatCategory.Video, ["ts"]),
new("m2ts", "M2TS", FormatCategory.Video, ["m2ts", "mts", "m2t"]),
new("3gp", "3GP", FormatCategory.Video, ["3gp", "3gpp"]),
diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.cs
index 7e4cea46..d4105e6e 100644
--- a/src/Filee.Core/Settings/AppSettings.cs
+++ b/src/Filee.Core/Settings/AppSettings.cs
@@ -109,7 +109,7 @@ public sealed class DonutSettings
public sealed class AppSettings
{
/// <summary>Current schema version. Increase when the format changes and add a migration.</summary>
- public const int CurrentSchemaVersion = 30;
+ public const int CurrentSchemaVersion = 31;
public int SchemaVersion { get; set; } = CurrentSchemaVersion;
diff --git a/src/Filee.Core/Settings/UserDataStore.cs b/src/Filee.Core/Settings/UserDataStore.cs
index 8bfee9b7..9c9f3467 100644
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@ -715,6 +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.
+ if (from < 31)
+ changed |= LearnExtensions(profiles, out _, ["log", "py", "pac", "bat", "command", "dat"]);
return changed;
}
diff --git a/src/Filee.Engines/Text/MarkdownConverter.cs b/src/Filee.Engines/Text/MarkdownConverter.cs
index 6e56ceb1..929e831e 100644
--- a/src/Filee.Engines/Text/MarkdownConverter.cs
+++ b/src/Filee.Engines/Text/MarkdownConverter.cs
@@ -1,4 +1,5 @@
-// Markdown → HTML and plain text with Markdig (BSD-2-Clause), in-process: Markdown works without any optional engine.
+// Markdown → HTML/TXT and plain-text aliases → TXT, in-process without executing source scripts.
+// Markdown rendering uses Markdig (BSD-2-Clause) and works without any optional engine.
// The HTML also serves as an intermediate step (Markdown → HTML → PDF / DOCX through LibreOffice), so local images
// get absolute file URIs whenever the page is written away from the Markdown file.
@@ -14,15 +15,15 @@ using Markdig.Syntax.Inlines;
namespace Filee.Engines.Text;
-/// <summary>Markdown to HTML and TXT without external programs.</summary>
+/// <summary>Markdown to HTML/TXT and plain text to UTF-8 TXT without external programs.</summary>
public sealed class MarkdownConverter : IConverter
{
public string Id => "markdown";
- public string DisplayName => "Markdown (built-in)";
+ public string DisplayName => "Text & Markdown (built-in)";
public int MaxParallelism => 0;
// Cheaper than Pandoc's Markdown edges, so the built-in path wins for HTML and TXT.
- public IReadOnlyList<ConversionEdge> Edges { get; } = [new("md", "html", 4), new("md", "txt", 5)];
+ public IReadOnlyList<ConversionEdge> Edges { get; } = [new("md", "html", 4), new("md", "txt", 5), new("txt", "txt", 4)];
public EngineStatus GetStatus() => EngineStatus.Available(version: EngineVersions.Library("Markdig", typeof(Markdown)));
@@ -37,7 +38,7 @@ public sealed class MarkdownConverter : IConverter
var content = step.To switch
{
"html" => ToHtml(markdown, Path.GetFullPath(step.InputPath), output),
- "txt" => Markdown.ToPlainText(markdown, MarkdownReader.Pipeline),
+ "txt" => step.From == "txt" ? markdown : Markdown.ToPlainText(markdown, MarkdownReader.Pipeline),
_ => throw new NotSupportedException(step.To),
};
await File.WriteAllTextAsync(output, content, new UTF8Encoding(encoderShouldEmitUTF8Identifier: step.To == "txt"), cancellationToken);
diff --git a/tests/Filee.Core.Tests/UserDataStoreTests.cs b/tests/Filee.Core.Tests/UserDataStoreTests.cs
index 7089e627..40836949 100644
--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs
+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs
@@ -6,6 +6,36 @@ namespace Filee.Core.Tests;
public class UserDataStoreTests
{
+ [Fact]
+ public void Version_30_learns_reported_text_and_video_extensions_without_taking_custom_claims()
+ {
+ using var dir = new TempDir();
+ var store = new UserDataStore(dir.Path);
+ 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");
+ store.Profiles.Insert(0, new ToolbarProfile { Id = "my-python", Name = "My code", Extensions = ["py"] });
+ store.SaveLibrary();
+ store.SaveSettings();
+
+ var upgraded = new UserDataStore(dir.Path);
+ upgraded.Load();
+ var text = upgraded.Profiles.Single(p => p.Id == "text");
+ Assert.Contains("log", text.Extensions);
+ Assert.Contains("pac", text.Extensions);
+ Assert.Contains("bat", text.Extensions);
+ Assert.Contains("command", text.Extensions);
+ 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);
+
+ var reloaded = new UserDataStore(dir.Path);
+ reloaded.Load();
+ Assert.Single(reloaded.Profiles, p => p.Extensions.Contains("py"));
+ Assert.Single(reloaded.Profiles, p => p.Extensions.Contains("dat"));
+ }
+
[Fact]
public void Groups_keep_only_conversions_once_and_at_most_six()
{
diff --git a/tests/Filee.Engines.Tests/ReportedIssueTests.cs b/tests/Filee.Engines.Tests/ReportedIssueTests.cs
new file mode 100644
index 00000000..b6ab6b65
--- /dev/null
+++ b/tests/Filee.Engines.Tests/ReportedIssueTests.cs
@@ -0,0 +1,131 @@
+// End-to-end regressions from the public issue audit: real converters and files, checked after conversion.
+
+using Filee.Core.Conversion;
+using Filee.Core.Formats;
+using Filee.Core.Presets;
+using Filee.Core.Watching;
+using Filee.Engines.Infrastructure;
+using Filee.Engines.Media;
+using ImageMagick;
+
+namespace Filee.Engines.Tests;
+
+public class ReportedIssueTests(EngineFixture fx) : IClassFixture<EngineFixture>
+{
+ [Theory]
+ [InlineData("mp4")]
+ [InlineData("mkv")]
+ public async Task Issue292_video_cd_dat_converts_with_video_and_audio_that_decode(string target)
+ {
+ var tools = FfmpegConverter.Locate();
+ Assert.SkipUnless(tools is not null, "FFmpeg is needed for the Video CD integration test.");
+ var folder = fx.NewFolder();
+ var input = Path.Combine(folder, "AVSEQ01.DAT");
+ var create = await ProcessRunner.RunAsync(tools.Value.Ffmpeg,
+ ["-hide_banner", "-loglevel", "error", "-f", "lavfi", "-i", "testsrc2=size=352x288:rate=25",
+ "-f", "lavfi", "-i", "sine=frequency=440:sample_rate=44100", "-t", "0.4",
+ "-target", "pal-vcd", "-f", "mpeg", input], TimeSpan.FromSeconds(30), TestContext.Current.CancellationToken);
+ Assert.True(create.ExitCode == 0, create.StandardError);
+
+ var job = await fx.ConvertAsync([input], new Preset { TargetFormat = target });
+ Assert.True(job.State == JobState.Completed, string.Join("; ", job.Files.Select(f => f.ErrorDetail)));
+ var output = Assert.Single(job.Outputs);
+ var decode = await ProcessRunner.RunAsync(tools.Value.Ffmpeg,
+ ["-v", "error", "-i", output, "-map", "0:v:0", "-map", "0:a:0", "-f", "null", "-"],
+ TimeSpan.FromSeconds(30), TestContext.Current.CancellationToken);
+ Assert.True(decode.ExitCode == 0, decode.StandardError);
+ Assert.True(File.Exists(input));
+ }
+
+ [Fact]
+ public async Task Issue292_non_video_dat_is_not_reported_as_a_successful_video()
+ {
+ Assert.SkipUnless(FfmpegConverter.Locate() is not null, "FFmpeg is needed for the DAT validation test.");
+ var input = Path.Combine(fx.NewFolder(), "database.dat");
+ await File.WriteAllTextAsync(input, "This is application data, not a video.", TestContext.Current.CancellationToken);
+ var job = await fx.ConvertAsync([input], new Preset { TargetFormat = "mp4" });
+ Assert.Equal(JobState.Failed, job.State);
+ Assert.Empty(job.Outputs);
+ Assert.True(File.Exists(input));
+ }
+
+ [Theory]
+ [InlineData("py")]
+ [InlineData("log")]
+ [InlineData("pac")]
+ [InlineData("bat")]
+ [InlineData("command")]
+ public async Task Reported_plain_text_extensions_convert_to_txt_without_executing_or_losing_content(string extension)
+ {
+ var folder = fx.NewFolder();
+ var input = Path.Combine(folder, "source." + extension);
+ const string Content = "# Local source text\nprint('مرحبا 中文 שלום')\n<not markup> & \"quoted\"\n";
+ await File.WriteAllTextAsync(input, Content, TestContext.Current.CancellationToken);
+
+ var job = await fx.ConvertAsync([input], new Preset { TargetFormat = "txt" });
+
+ Assert.Equal(JobState.Completed, job.State);
+ var output = Assert.Single(job.Outputs);
+ Assert.Equal(".txt", Path.GetExtension(output));
+ Assert.Equal(Content, await File.ReadAllTextAsync(output, TestContext.Current.CancellationToken));
+ Assert.Equal(Content, await File.ReadAllTextAsync(input, TestContext.Current.CancellationToken));
+ Assert.Equal("txt", FormatRegistry.Detect(input)?.Id);
+ }
+
+ [Theory]
+ [InlineData("py")]
+ [InlineData("bat")]
+ [InlineData("command")]
+ public async Task Exporting_script_source_never_executes_the_script(string extension)
+ {
+ var folder = fx.NewFolder();
+ var marker = Path.Combine(folder, "executed.txt").Replace('\\', '/');
+ var input = Path.Combine(folder, "script." + extension);
+ var content = extension switch
+ {
+ "py" => $"from pathlib import Path\nPath(r'{marker}').write_text('executed')\n",
+ "bat" => $"@echo off\r\necho executed>\"{marker}\"\r\n",
+ _ => $"#!/bin/sh\nprintf executed > '{marker}'\n",
+ };
+ await File.WriteAllTextAsync(input, content, TestContext.Current.CancellationToken);
+ var job = await fx.ConvertAsync([input], new Preset { TargetFormat = "txt" });
+ Assert.Equal(JobState.Completed, job.State);
+ Assert.Equal(content, await File.ReadAllTextAsync(Assert.Single(job.Outputs), TestContext.Current.CancellationToken));
+ Assert.False(File.Exists(marker));
+ }
+
+ [Theory]
+ [InlineData(AfterConversion.Keep)]
+ [InlineData(AfterConversion.MoveToOriginals)]
+ public async Task Issue234_webp_becomes_a_readable_jpg_in_the_same_watch_folder(AfterConversion originals)
+ {
+ var folder = fx.NewFolder();
+ var input = EngineFixture.MakeImage(folder, "photo.webp", MagickFormat.WebP);
+ var rule = new WatchRule { Folder = folder, OutputFolder = folder, Originals = originals };
+ var jobs = new List<ConversionJob>();
+ await using var watcher = new FolderWatcher(rule, async (files, _) =>
+ {
+ var job = await fx.ConvertAsync(files, rule.Apply(new Preset { TargetFormat = "jpg" }));
+ jobs.Add(job);
+ return job;
+ }, settleTime: TimeSpan.Zero);
+
+ watcher.Notice(input);
+ Assert.Equal(1, await watcher.ProcessPendingAsync());
+ var job = Assert.Single(jobs);
+ Assert.Equal(JobState.Completed, job.State);
+ var output = Assert.Single(job.Outputs);
+ Assert.Equal(Path.Combine(folder, "photo.jpg"), output);
+ using var image = new MagickImage(output);
+ Assert.Equal(MagickFormat.Jpeg, image.Format);
+ Assert.Equal(320u, image.Width);
+ Assert.Equal(200u, image.Height);
+ Assert.Equal(originals == AfterConversion.Keep, File.Exists(input));
+ if (originals == AfterConversion.MoveToOriginals)
+ Assert.True(File.Exists(Path.Combine(rule.OriginalsFolder, "photo.webp")));
+
+ watcher.Notice(output);
+ Assert.Equal(0, await watcher.ProcessPendingAsync());
+ Assert.Single(jobs);
+ }
+}