fix(epub): decode footnote href path before spine lookup (#2271)
This commit is contained in:
+4
-4
@@ -900,10 +900,10 @@ float Epub::calculateProgress(const int currentSpineIndex, const float currentSp
|
|||||||
int Epub::resolveHrefToSpineIndex(const std::string& href) const {
|
int Epub::resolveHrefToSpineIndex(const std::string& href) const {
|
||||||
if (!bookMetadataCache || !bookMetadataCache->isLoaded()) return -1;
|
if (!bookMetadataCache || !bookMetadataCache->isLoaded()) return -1;
|
||||||
|
|
||||||
// Extract filename (remove #anchor)
|
// Split before decoding so escaped '#' characters in filenames stay part of the path.
|
||||||
std::string target = href;
|
const size_t hashPos = href.find('#');
|
||||||
size_t hashPos = target.find('#');
|
const std::string rawTarget = hashPos != std::string::npos ? href.substr(0, hashPos) : href;
|
||||||
if (hashPos != std::string::npos) target = target.substr(0, hashPos);
|
const std::string target = FsHelpers::normalisePath(FsHelpers::decodeUriEscapes(rawTarget));
|
||||||
|
|
||||||
// Same-file reference (anchor-only)
|
// Same-file reference (anchor-only)
|
||||||
if (target.empty()) return -1;
|
if (target.empty()) return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user