I'd seen that before but hadn't actually understood what the author was getting at. Looking at it again, I realize it's the hyperlink file-mapping bug in ConvertLIT. This is fixed in calibre when using the calibre-native LIT-extraction code, and I've updated the wiki to reflect this fact.

I'd seen that before but hadn't actually understood what the author was getting at. Looking at it again, I realize it's the hyperlink file-mapping bug in ConvertLIT. This is fixed in calibre when using the calibre-native LIT-extraction code, and I've updated the wiki to reflect this fact.

I was the author of that article...some time ago now. Note I use capitalization not as shouting but for explanation (same as in the wiki)

These issues are not the same, IMHO.

First off a basic explanation of the two issues -
ConvertLIT has a bug which will cause references to files sharing a common filename prefix to all refer to the shortest-named so-prefixed file. My fix has nothing to do with fixing this error (which is a somewhat similar error that I have not encountered) but only to fix NOTES links where after conversion you would find all your notes links would bring you back to the Table of Contents page rather than to the note you wanted to read.

Because in my ebooks CHAPTER links work in the exploded .LITs if browsing as webpages and only the NOTES links do not work.

All NOTES links were pointing to, one example, 20002285toc.html (table of contents)
rather than the main text 20002285.html.

In this case the longer file name was being pointed to not the shorter (in your case you are talking about referring to a shorter file name only). Further, in my cases this was always the table of contents which was always a small .html.

My fix seems to be unrelated to works of fiction and only occurs in non-fiction books that have a large number (several hundred) of NOTES links (as fiction books generally do not have hundreds of links).

In your case I guess you would also be talking about Chapter links, in my cases these were perfect.

No, they are the same. I just got myself backwards when thinking about what was causing the bug and put "shortest" when "a longer" was correct. This most commonly shows up with footnotes because you'll have files like note1.html, note2.html, ..., note44.html. ConvertLIT internally has a list of filename IDs which are usually the filename without the extension (note1, ..., note44). To fix-up the link it searches through this list, but does so in a way which doesn't distinguish between a full match and an initial substring match. So if it's looking for 'note1' and it finds 'note14' first, then it'll link to 'note14.html' instead of 'note1.html'.

Sorry for the confusion, but the good news is that in the future you can use calibre with 'lit2oeb' and not need fix things up by hand . If you try 'lit2oeb' and footnote links still aren't correct, please file a bug on the calibre trac so that it can be fixed.

No, they are the same. I just got myself backwards when thinking about what was causing the bug and put "shortest" when "a longer" was correct. This most commonly shows up with footnotes because you'll have files like note1.html, note2.html, ..., note44.html. ConvertLIT internally has a list of filename IDs which are usually the filename without the extension (note1, ..., note44). To fix-up the link it searches through this list, but does so in a way which doesn't distinguish between a full match and an initial substring match. So if it's looking for 'note1' and it finds 'note14' first, then it'll link to 'note14.html' instead of 'note1.html'.

Sorry for the confusion, but the good news is that in the future you can use calibre with 'lit2oeb' and not need fix things up by hand . If you try 'lit2oeb' and footnote links still aren't correct, please file a bug on the calibre trac so that it can be fixed.

Hope this helps,

-Marshall

Thanks for your effort, you are the first person to really discuss this issue with me. I think you are more knowledgeable than me by a long way how Calibre works.

However I did not have any notes links having the error you describe - the ebooks in question did not have footnotes but just a number after a sentence and then at the end of a chapter a list of note numbers each with the associated note text. There are no notes in the Table of contents pages which is what each note was linking to.

So in my case everything about the link was correct, if note 14 it was note 14 never note 1. Only problem was it was searching in the Table of Conents page which had no note links at all.

Could your problem be fixed by the same find and replace method that fixes mine?

Note that it wasn't the longest or shortest filename that defined the error - just that it pointed to the table of contents.html

Please feel free to change to reflect your understanding so we can nut this out.

I'm still pretty sure the issues are the same... Hmm. Could you do me a favor and try extracting one of your books with this problem using 'lit2oeb' from the most recent version of calibre? If it extracts your file without the problem you noticed before, then the issues identical. Thanks in advance !

It seems instead of 2 errors it was 1 error (incorrect hyperlinks) that had 2 different outcomes depending upon whether the ebook had the notes internally in the main.html or as individual notes.html (eg note1.html, note2.html etc).