Skip to content

Read PowerShell scripts (.ps1) as plain text (#442, #455) - #474

Merged
KnifeLemon merged 1 commit into
KnifeLemon:mainfrom
cre8ive-marketing:feature/ps1-text
Oct 23, 2026
Merged

KnifeLemon merged 1 commit into
KnifeLemon:mainfrom
cre8ive-marketing:feature/ps1-text

Conversation

@cre8ive-marketing

Copy link
Copy Markdown
Collaborator

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: ps1 joins the TXT format's extensions. The built-in text donut takes its extensions from there, so new libraries have it.
  • Settings schema 39 teaches existing text donuts .ps1, unless a donut of the user's own already claims it (LearnExtensions, like v34 for .lua and .css). Recognize text in scans and pictures with Tesseract (OCR, #288) #429 (OCR) also uses 39, so whichever merges second needs the next number.
  • .ps1 stays on WebFileNames.Blocked: a PowerShell script offered by a web page is still refused, as before. Only files already on the PC are converted, as with .bat and .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-changes
  • dotnet test: Platform 48, Core 503, Cli 27, Setup 149, Engines 1593, App 847 pass, none fail.
  • ScriptTextTests:
    • Backup.ps1 is detected as TXT.
    • New 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

  • New UI strings are in all src/Filee.App/Assets/i18n/*.json files (none added)
  • New third-party code or binaries are listed in THIRD-PARTY-NOTICES.md (none)

Fixes #442. Fixes #455.

…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.
This was referenced Oct 23, 2026
@cre8ive-marketing cre8ive-marketing self-assigned this Oct 23, 2026
@KnifeLemon KnifeLemon added the formats New formats and engines label Oct 23, 2026

@KnifeLemon KnifeLemon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.cs has the .lua / .css → PDF case (read, never run). A Backup.ps1 line there would cover the engine side too.
  • The comment above the TXT line in FormatRegistry lists 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!

@KnifeLemon
KnifeLemon merged commit 4bce41e into KnifeLemon:main Oct 23, 2026
10 checks passed
cre8ive-marketing added a commit to cre8ive-marketing/Filee that referenced this pull request Oct 23, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

formats New formats and engines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Format request: .ps1 Format request: .ps1

2 participants