Skip to content

Commit

Permalink
refactor(pdf): use canonical paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed Oct 1, 2024
1 parent 66e7d0c commit 942362b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ namespace pdfcomp
Magick::InitializeMagick(path.string().c_str());
});

impl data{};
auto path = fs::canonical(document);
auto data = impl{};

try
{
Magick::readImages(&data.pages, document.string());
Magick::readImages(&data.pages, path.string());
}
catch (Magick::Error &err)
{
std::println(stderr, "Error: {}", err.what());
std::println(stderr, "Error ('{}'): {}", path.string(), err.what());
return tl::unexpected{error::bad_file};
}

Expand Down

0 comments on commit 942362b

Please sign in to comment.