mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
handle absolute relationship targets the correct way
This commit is contained in:
parent
7b391321f6
commit
7834b564f4
|
@ -187,10 +187,16 @@ std::vector<relationship> xlsx_consumer::read_relationships(const path &part)
|
|||
const auto target_mode = parser.attribute_present("TargetMode")
|
||||
? parser.attribute<xlnt::target_mode>("TargetMode")
|
||||
: xlnt::target_mode::internal;
|
||||
auto target = xlnt::uri(parser.attribute("Target"));
|
||||
|
||||
if (target.path().is_absolute() && target_mode == target_mode::internal)
|
||||
{
|
||||
target = uri(target.path().relative_to(path(part.string()).resolve(path("/"))).string());
|
||||
}
|
||||
|
||||
relationships.emplace_back(parser.attribute("Id"),
|
||||
parser.attribute<xlnt::relationship_type>("Type"),
|
||||
xlnt::uri(part.string()), xlnt::uri(parser.attribute("Target")),
|
||||
target_mode);
|
||||
xlnt::uri(part.string()), target, target_mode);
|
||||
|
||||
expect_end_element(qn("relationships", "Relationship"));
|
||||
}
|
||||
|
|
|
@ -39,11 +39,6 @@ void manifest::clear()
|
|||
|
||||
path manifest::canonicalize(const std::vector<xlnt::relationship> &rels) const
|
||||
{
|
||||
if (rels.back().target().path().is_absolute())
|
||||
{
|
||||
return rels.back().target().path().relative_to(path("/"));
|
||||
}
|
||||
|
||||
xlnt::path relative;
|
||||
|
||||
for (auto component : rels)
|
||||
|
|
Loading…
Reference in New Issue
Block a user