feat: Add support for Postscript files#1399
Conversation
Allow thumbnail generation for .ps and .eps files via Ghostscript.
Use general document icon as Nerd font doesn't include own PS icon
📝 WalkthroughWalkthroughAdded PostScript file format support through an icon configuration entry and a new Ghostscript-based thumbnail generator. The thumbnail generator conditionally activates when Ghostscript is installed and processes Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/pkg/file_preview/thumbnail_generator.go (1)
129-129: Clarify the resolution comment.The comment states "Resolution (the same as for pdf)" but the
pdfGenerator.generateThumbnailmethod (lines 87-92) doesn't specify an explicit resolution parameter forpdftoppm. This comment could be misleading.📝 Suggested clarification
- "-r150", // Resolution (the same as for pdf) + "-r150", // Resolution (150 DPI)or verify and update to:
- "-r150", // Resolution (the same as for pdf) + "-r150", // Resolution (matches pdftoppm default of 150 DPI)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pkg/file_preview/thumbnail_generator.go` at line 129, The comment for "-r150" is misleading because pdfGenerator.generateThumbnail does not explicitly set pdftoppm resolution; either update the comment to state a concrete meaning (e.g., "Resolution for image export: 150 DPI") and remove "(the same as for pdf)", or change pdfGenerator.generateThumbnail to pass the same explicit resolution (150) to the pdftoppm invocation so both places match; locate the pdftoppm call in pdfGenerator.generateThumbnail and either add a resolution flag there or update the "-r150" comment in thumbnail_generator.go to a clear, accurate description.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/config/icon/icon.go`:
- Line 135: The icon for key "ps" uses an invalid Unicode escape "\U000f1517";
replace it with a valid Nerd Font glyph codepoint (for example U+F15C3) so the
Icon field in the map entry for "ps" contains a renderable Nerd Font glyph;
update the Icon value (the Icon field in the map entry keyed by "ps") to the
correct escape sequence for the chosen codepoint and keep the existing Color
value unchanged.
---
Nitpick comments:
In `@src/pkg/file_preview/thumbnail_generator.go`:
- Line 129: The comment for "-r150" is misleading because
pdfGenerator.generateThumbnail does not explicitly set pdftoppm resolution;
either update the comment to state a concrete meaning (e.g., "Resolution for
image export: 150 DPI") and remove "(the same as for pdf)", or change
pdfGenerator.generateThumbnail to pass the same explicit resolution (150) to the
pdftoppm invocation so both places match; locate the pdftoppm call in
pdfGenerator.generateThumbnail and either add a resolution flag there or update
the "-r150" comment in thumbnail_generator.go to a clear, accurate description.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2f9e67b4-55bb-479e-b9e8-48115b6e707d
📒 Files selected for processing (2)
src/config/icon/icon.gosrc/pkg/file_preview/thumbnail_generator.go
Postscript files are less common than PDFs these days, but adding their support to Superfile is relatively easy.
Summary by CodeRabbit