mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-06-06 09:31:16 -04:00
Fix relative path extraction in ExportContext when base directory is empty
Fixes #437 Fixes #434
This commit is contained in:
parent
047dccef7f
commit
37fcee2f21
1 changed files with 5 additions and 2 deletions
|
@ -74,8 +74,11 @@ namespace DiscordChatExporter.Domain.Exporting
|
||||||
{
|
{
|
||||||
var filePath = await _mediaDownloader.DownloadAsync(url);
|
var filePath = await _mediaDownloader.DownloadAsync(url);
|
||||||
|
|
||||||
// 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);
|
// Base directory path may be null if the file is stored at the root or relative to working directory.
|
||||||
|
var relativeFilePath = !string.IsNullOrWhiteSpace(Request.OutputBaseDirPath)
|
||||||
|
? Path.GetRelativePath(Request.OutputBaseDirPath, filePath)
|
||||||
|
: filePath;
|
||||||
|
|
||||||
// HACK: for HTML, we need to format the URL properly
|
// HACK: for HTML, we need to format the URL properly
|
||||||
if (Request.Format == ExportFormat.HtmlDark || Request.Format == ExportFormat.HtmlLight)
|
if (Request.Format == ExportFormat.HtmlDark || Request.Format == ExportFormat.HtmlLight)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue