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
2c5d579a1b
commit
eb201f5f70
|
@ -165,10 +165,16 @@ std::vector<relationship> xlsx_consumer::read_relationships(const path &part)
|
||||||
const auto target_mode = parser.attribute_present("TargetMode")
|
const auto target_mode = parser.attribute_present("TargetMode")
|
||||||
? parser.attribute<xlnt::target_mode>("TargetMode")
|
? parser.attribute<xlnt::target_mode>("TargetMode")
|
||||||
: xlnt::target_mode::internal;
|
: 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"),
|
relationships.emplace_back(parser.attribute("Id"),
|
||||||
parser.attribute<xlnt::relationship_type>("Type"),
|
parser.attribute<xlnt::relationship_type>("Type"),
|
||||||
xlnt::uri(part.string()), xlnt::uri(parser.attribute("Target")),
|
xlnt::uri(part.string()), target, target_mode);
|
||||||
target_mode);
|
|
||||||
|
|
||||||
expect_end_element(qn("relationships", "Relationship"));
|
expect_end_element(qn("relationships", "Relationship"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user