File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -441,7 +441,11 @@ bool Image::is_internal(const abstract::Document *document) const {
441441 return false ;
442442 }
443443 try {
444- return doc->as_filesystem ()->is_file (common::Path (href (document)));
444+ common::Path path (href (document));
445+ if (path.relative ()) {
446+ path = common::Path (" /" ).join (path);
447+ }
448+ return doc->as_filesystem ()->is_file (path);
445449 } catch (...) {
446450 }
447451 return false ;
@@ -452,7 +456,11 @@ std::optional<odr::File> Image::file(const abstract::Document *document) const {
452456 if (!doc || !is_internal (document)) {
453457 return {};
454458 }
455- return File (doc->as_filesystem ()->open (common::Path (href (document))));
459+ common::Path path (href (document));
460+ if (path.relative ()) {
461+ path = common::Path (" /" ).join (path);
462+ }
463+ return File (doc->as_filesystem ()->open (path));
456464}
457465
458466std::string Image::href (const abstract::Document *) const {
Original file line number Diff line number Diff line change 88#include < odr/internal/ooxml/text/ooxml_text_document.hpp>
99#include < odr/internal/util/xml_util.hpp>
1010
11- #include < functional>
1211#include < optional>
1312
1413#include < pugixml.hpp>
@@ -285,7 +284,11 @@ std::optional<odr::File> Image::file(const abstract::Document *document) const {
285284 if (!doc || !is_internal (document)) {
286285 return {};
287286 }
288- return File (doc->as_filesystem ()->open (common::Path (href (document))));
287+ common::Path path (href (document));
288+ if (path.relative ()) {
289+ path = common::Path (" /" ).join (path);
290+ }
291+ return File (doc->as_filesystem ()->open (path));
289292}
290293
291294std::string Image::href (const abstract::Document *document) const {
You can’t perform that action at this time.
0 commit comments