Skip to content
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

Fix file path encoding edge cases in HTML export #1351

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

Tyrrrz
Copy link
Owner

@Tyrrrz Tyrrrz commented Mar 9, 2025

Closes #1324

Choose a reason for hiding this comment

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

PR Overview

This pull request aims to fix edge cases in file path encoding for HTML exports. The changes introduce a new utility function to encode file paths and update the HTML export logic to use this function.

  • Introduces the Url.EncodeFilePath method in the Utils namespace.
  • Updates ExportContext to use Url.EncodeFilePath instead of manually formatting file URIs.

Reviewed Changes

File Description
DiscordChatExporter.Core/Utils/Url.cs New helper for encoding file paths with normalization.
DiscordChatExporter.Core/Exporting/ExportContext.cs Updates file path formatting logic for HTML exports.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

DiscordChatExporter.Core/Utils/Url.cs:18

  • The char array literal syntax is invalid in C#. Please change [':', '/', ''] to new char[]{':', '/', ''}.
var separatorIndex = filePath.IndexOfAny([':', '/', '\'], position);

DiscordChatExporter.Core/Exporting/ExportContext.cs:137

  • The previous logic formatted the file URI with conditional handling for relative paths. Please confirm that using Url.EncodeFilePath directly meets the intended behavior for both relative and absolute paths in HTML exports.
return Url.EncodeFilePath(optimalFilePath);
@Tyrrrz Tyrrrz merged commit db50a2b into master Mar 10, 2025
25 checks passed
@Tyrrrz Tyrrrz deleted the fix-url-formatting-html branch March 10, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant