Repository navigation
Read PowerShell scripts (.ps1) as plain text (#442, #455) - #474
Conversation
…mon#455) Like .bat, .py and .lua: recognised as text and converted to TXT, PDF, Markdown, Word and the rest, never run. Settings schema 39 teaches existing text donuts .ps1; a .ps1 offered by a web page stays refused as before.
KnifeLemon
left a comment
There was a problem hiding this comment.
Thanks @cre8ive-marketing, small and tidy, and it follows the .lua / .css change line for line. I merged it with current main and ran dotnet format --verify-no-changes, the build, the Core tests (503 passed) and the CLI tests (27 passed). I also converted three PowerShell scripts with filee-cli, one each in UTF-16 LE with a BOM, UTF-8 with a BOM and CP949, all with Korean comments and a New-Item line. All three came out as the same UTF-8 text in TXT and Markdown, and the New-Item line never ran. A .ps1 offered by a web page is still refused (WebFileNames.Blocked, covered by BrowserDragFormatsTests with run.ps1).
Two optional bits, fine to leave out:
tests/Filee.Engines.Tests/ScriptTextTests.cshas the.lua/.css→ PDF case (read, never run). ABackup.ps1line there would cover the engine side too.- The comment above the TXT line in
FormatRegistrylists the issues each extension came from. #442 could go on that list.
About the schema: #429 and #470 also use 39. We give out the numbers in merge order when we merge (the migration line, CurrentSchemaVersion and the version numbers in your test), so there's nothing for you to do. Thanks!
main took settings schema 39 for .ps1 (KnifeLemon#474), so the Searchable PDF step moves to v40 (CurrentSchemaVersion = 40); its test upgrades a version 39 library. README: main's one-line engines entry, with the OCR languages.
What does this change?
Adds PowerShell scripts (
.ps1) as plain text, as asked in #442 and #455 (the same request), the same way #393 added.lua. They're read as text and converted to TXT, PDF, Markdown, Word and the rest, and never run.FormatRegistry:ps1joins the TXT format's extensions. The built-in text donut takes its extensions from there, so new libraries have it..ps1, unless a donut of the user's own already claims it (LearnExtensions, like v34 for.luaand.css). Recognize text in scans and pictures with Tesseract (OCR, #288) #429 (OCR) also uses 39, so whichever merges second needs the next number..ps1stays onWebFileNames.Blocked: a PowerShell script offered by a web page is still refused, as before. Only files already on the PC are converted, as with.batand.py.docs/ENGINES.md: the Text row lists PS1..psm1/.psd1(modules and manifests) aren't added, because nobody asked for them; they could join the same line later.How was it tested?
dotnet format --verify-no-changesdotnet test: Platform 48, Core 503, Cli 27, Setup 149, Engines 1593, App 847 pass, none fail.ScriptTextTests:Backup.ps1is detected as TXT.Version_38_text_donuts_learn_powershell_scripts: a version 38 library's text donut learns.ps1, and the upgrade from 39 changes nothing.Screenshots (UI changes)
No UI changes.
Checklist
src/Filee.App/Assets/i18n/*.jsonfiles (none added)THIRD-PARTY-NOTICES.md(none)Fixes #442. Fixes #455.