-
-
Notifications
You must be signed in to change notification settings - Fork 284
Add MSG to EML email conversion support (#367) #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add new msgconvert converter using libemail-outlook-message-perl - Support conversion from Outlook MSG files to standard EML format - Add msgconvert to Docker dependencies and version checking - Register msgconvert converter in main converter registry Implements feature request C4illin#367 for email format conversion
Reviewer's GuideThis PR implements Outlook MSG to EML conversion by integrating the Perl-based msgconvert tool: it adds a new converter module with execution logic, registers it in the main registry, ensures the tool is installed in Docker, and surfaces its version in the printVersions helper. Sequence diagram for MSG to EML conversion processsequenceDiagram
participant User
participant ConverterRegistry
participant msgconvert_module as msgconvert
participant msgconvert_tool as msgconvert (CLI)
User->>ConverterRegistry: Request conversion (MSG to EML)
ConverterRegistry->>msgconvert: Call convert()
msgconvert->>msgconvert_tool: Execute msgconvert CLI
msgconvert_tool-->>msgconvert: Conversion result
msgconvert-->>ConverterRegistry: Done
ConverterRegistry-->>User: Conversion complete
Class diagram for updated converter registry in main.tsclassDiagram
class ConverterRegistry {
+pandoc
+msgconvert
+dvisvgm
...
}
class msgconvert {
+properties
+convert()
}
ConverterRegistry --> msgconvert : registers
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @gingeekrishna - I've reviewed your changes - here's some feedback:
- Align the export names in msgconvert.ts with how you import them in main.ts (e.g. export convertMsgconvert or adjust the registry import) to avoid naming mismatches.
- Improve error handling by rejecting with Error objects (instead of plain strings) and resolving with the actual output file path rather than a static "Done" message for better downstream usage.
- Consider extracting the execFile promise-handling boilerplate into a shared helper to reduce duplication across converters and simplify future additions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Align the export names in msgconvert.ts with how you import them in main.ts (e.g. export convertMsgconvert or adjust the registry import) to avoid naming mismatches.
- Improve error handling by rejecting with Error objects (instead of plain strings) and resolving with the actual output file path rather than a static "Done" message for better downstream usage.
- Consider extracting the execFile promise-handling boilerplate into a shared helper to reduce duplication across converters and simplify future additions.
## Individual Comments
### Comment 1
<location> `src/converters/msgconvert.ts:33` </location>
<code_context>
+ return;
+ }
+
+ if (stdout) {
+ console.log(`stdout: ${stdout}`);
+ }
+
</code_context>
<issue_to_address>
Logging stdout may be unnecessary and could clutter output.
If there's no specific reason to log msgconvert's stdout, please remove this console.log to keep production output clean.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
if (stdout) {
console.log(`stdout: ${stdout}`);
}
=======
>>>>>>> REPLACE
</suggested_fix>
### Comment 2
<location> `src/converters/msgconvert.ts:37` </location>
<code_context>
+ console.log(`stdout: ${stdout}`);
+ }
+
+ if (stderr) {
+ console.error(`stderr: ${stderr}`);
+ }
+
</code_context>
<issue_to_address>
Logging stderr directly may expose internal details.
Consider logging stderr conditionally or sanitizing its content to avoid exposing sensitive information.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
if (stderr) {
console.error(`stderr: ${stderr}`);
}
=======
if (stderr) {
// Sanitize stderr to avoid exposing sensitive information
const sanitizedStderr = stderr.replace(/(\/[^\s]+)/g, "[REDACTED_PATH]");
// Optionally, log a generic message or the sanitized content
console.error(`stderr: ${sanitizedStderr.length > 200 ? sanitizedStderr.slice(0, 200) + '...' : sanitizedStderr}`);
}
>>>>>>> REPLACE
</suggested_fix>
### Comment 3
<location> `src/converters/msgconvert.ts:41` </location>
<code_context>
+ console.error(`stderr: ${stderr}`);
+ }
+
+ resolve("Done");
+ });
+ } else {
</code_context>
<issue_to_address>
Returning a static string on success may be limiting.
Consider returning targetPath or relevant result data instead to provide more useful context for callers and improve future flexibility.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
resolve("Done");
=======
resolve(targetPath);
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/converters/msgconvert.ts
Outdated
if (stdout) { | ||
console.log(`stdout: ${stdout}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Logging stdout may be unnecessary and could clutter output.
If there's no specific reason to log msgconvert's stdout, please remove this console.log to keep production output clean.
if (stdout) { | |
console.log(`stdout: ${stdout}`); | |
} |
src/converters/msgconvert.ts
Outdated
if (stderr) { | ||
console.error(`stderr: ${stderr}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 suggestion (security): Logging stderr directly may expose internal details.
Consider logging stderr conditionally or sanitizing its content to avoid exposing sensitive information.
if (stderr) { | |
console.error(`stderr: ${stderr}`); | |
} | |
if (stderr) { | |
// Sanitize stderr to avoid exposing sensitive information | |
const sanitizedStderr = stderr.replace(/(\/[^\s]+)/g, "[REDACTED_PATH]"); | |
// Optionally, log a generic message or the sanitized content | |
console.error(`stderr: ${sanitizedStderr.length > 200 ? sanitizedStderr.slice(0, 200) + '...' : sanitizedStderr}`); | |
} |
- Remove unnecessary stdout logging to reduce output clutter - Sanitize stderr logging to protect sensitive path information - Return targetPath instead of generic 'Done' message for better caller context - Use proper Error objects instead of string rejections - Address Sourcery AI feedback from PR C4illin#370
Thanks for this! |
Implements feature request #367 for email format conversion
Summary by Sourcery
Add support for converting Outlook MSG files to standard EML format using the msgconvert tool.
New Features:
Enhancements:
Build: