mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-23 19:26:57 -04:00
Don't escape media URL on non-HTML formats
This commit is contained in:
parent
1ff026eba6
commit
e1b1755fba
1 changed files with 10 additions and 6 deletions
|
@ -72,13 +72,17 @@ namespace DiscordChatExporter.Domain.Exporting
|
||||||
// We want relative path so that the output files can be copied around without breaking
|
// We want relative path so that the output files can be copied around without breaking
|
||||||
var relativeFilePath = Path.GetRelativePath(Request.OutputBaseDirPath, filePath);
|
var relativeFilePath = Path.GetRelativePath(Request.OutputBaseDirPath, filePath);
|
||||||
|
|
||||||
// Need to properly escape each path segment while keeping the slashes
|
// For HTML, we need to format the URL properly
|
||||||
var escapedRelativeFilePath = relativeFilePath
|
if (Request.Format == ExportFormat.HtmlDark || Request.Format == ExportFormat.HtmlLight)
|
||||||
.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
|
{
|
||||||
.Select(Uri.EscapeDataString)
|
// Need to escape each path segment while keeping the directory separators intact
|
||||||
.JoinToString(Path.AltDirectorySeparatorChar.ToString());
|
return relativeFilePath
|
||||||
|
.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
|
||||||
|
.Select(Uri.EscapeDataString)
|
||||||
|
.JoinToString(Path.AltDirectorySeparatorChar.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
return escapedRelativeFilePath;
|
return relativeFilePath;
|
||||||
}
|
}
|
||||||
catch (HttpRequestException)
|
catch (HttpRequestException)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue