Sigil-Ebook / Sigil

Sigil is a multi-platform EPUB ebook editor
GNU General Public License v3.0
5.96k stars 578 forks source link

[Bug]: files not listed in the manifest #728

Closed lenatime closed 1 year ago

lenatime commented 1 year ago

Bug Description

After replacing images in a few chapters, I removed the old images, and then every time I opened up the sigil file, it gave this error message "Files exist in epub that are not listed in the manifest - they will be ignored" or something close to that. The image files were no longer in the manifest and they were no longer in the images directory, so I couldn't figure out how to make that error message go away. So, I added the image files back into the image directory and that error message went away. But it's weird, right, because I have these extra image files not being used within this ePub, When I tried to remove these 'unused' media files using the remove unused media tool, Sigil crashed, just closed on me. That tool did list all of the same image files that were unused, and which were also listed in the manifest error message. When I opened it up again, these unused image files were still there. Am I missing something with how to remove these files? Do I need to remove these in the manifest first and then simply delete the unused image files? I'm concerned that if I do this, I'll be back to the original error message. I guess I may try to simply rebuild the whole project again, which is not an ideal solution.

Platform (OS)

Windows (Default)

OS Version / Specifics

Windows 10 Home / OS Build: 19045.3448 / version: 22H2

What version of Sigil are you using?

2.0.1

Any backtraces or crash reports

No report was generated.  Sigil just closed down.
kevinhendricks commented 1 year ago

Something is strange.

Have you by chance check your harddrive to make sure you do not have a corrupted disc?

That warning dialog should give you a list of the exact files that are not listed in the manifest. Please snap a screenshot of that list of unmanifested files and then a screenshot of the opf file manifest and post them here so I can see what is going on.

Alternatively, I would be happy to take a look the problem epub and fix it (or explain to you how to fix it yourself).

Just post a copy of the epub in question and directly e-mail me a link to it. Or if the epub is not large send it to me directly.

My personal e-mail address is:

removed to prevent spam harvesters from collecting it

You should never need to rebuild it from scratch.

kevinhendricks commented 1 year ago

My initial wild guess without any evidence is that there are two image files with the same name (but with upper vs lower case changes) with one in a different folder and it is confusing both the manifest warning or the delete unused media or both since Windows is case insensitive file system.

Once deleted it still appears to be there since Windows is case insensitive, but the urls in the opf manifest are always case sensitive and must exactly match the actual file.

lenatime commented 1 year ago

Hi Kevin,

That's a relief ("You should never need to rebuild it from scratch.")!

I didn't change the file names at all, from lower or upper case.

It appears that--perhaps by adding back the files the manifest listed as missing--it fixed itself. I deleted the files directly from the image folder and closed the ePub project and then when I opened it up again, no error message. I didn't try the 'delete unused media files...' tool though. Presumably, that function is working.

However, I made a copy of this ePub project prior to re-adding the missing files, so you can see the error message and compare it to the manifest. If you add the missing files back and then try to remove these through the 'delete unused media files...' tool, you should see Sigil crash as well. Maybe I should have tried that tool before adding the 'missing' images back into the image directory.

I'll share both ePub files plus the missing files/images listed in the error message. (too big to email, I think) The skinnys2.epub file is the one that still has the error message.

https://1drv.ms/f/s!Au6oKtVUv3K0kOxU_4tzNX3Uj5Az9w?e=w8GlnR

If you need me to walk the steps again, I can. I'll just do that now.

  1. Added images to the photo pages. Decided to add captions to the images, because I couldn't figure out how to keep the caption and photo from separating.
  2. Added the new images with different file names to the images directory.
  3. Updated each photo page with the new image file name.
  4. Renamed some of the photo pages too. (not sure that's relevant)
  5. Closed the ePub file and the next time I opened it, I got that manifest error message.
  6. Decided to add the old images back into the images directory (because they were listed in the manifest details). And the manifest error message went away.
  7. Tried the 'delete unused media files...' tool and Sigil crashed.

Later, after reading your comments, I opened the file and deleted the unused images from the images directory, to get that error message back, but I didn't get a manifest error message. As I mentioned, however, I made a copy, which has that manifest error (skinnys2.epub).

I like Sigil. I hope this helps to figure out whatever this issue is.


On 2023-09-29 22:49, Kevin Hendricks wrote:

Something is strange.

Have you by chance check your harddrive to make sure you do not have a corrupted disc?

That warning dialog should give you a list of the exact files that are not listed in the manifest. Please snap a screenshot of that list of unmanifested files and then a screenshot of the opf file manifest and post them here so I can see what is going on.

Alternatively, I would be happy to take a look the problem epub and fix it (or explain to you how to fix it yourself).

Just post a copy of the epub in question and directly e-mail me a link to it. Or if the epub is not large send it to me directly.

My personal e-mail address is:

@.***

You should never need to rebuild it from scratch.

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>

Links:

[1] https://github.com/Sigil-Ebook/Sigil/issues/728#issuecomment-1741638027 [2] https://github.com/notifications/unsubscribe-auth/ACTEIJVPIVGH5JDK2L465CDX46CDVANCNFSM6AAAAAA5NHCVMA

kevinhendricks commented 1 year ago

Okay, using a copy of skinny2.epub, I opened it and received the "unmanifested files" warning.

First I downloaded and installed Doitsu's useful "DeleteUnmanifestededFiles_v0.1.2.zip" Sigil plugin from Mobileread, ran it and again all was fine. No crashes with Delete Unused Media.

Next I took a copy of skinny2.epub and unzipped it manually and looked inside and sure enough those files were inside the unzipped epub and not listed in the opf manifest. I then manually deleted them from the unzipped epub folder. Then used Sigil's FolderIn plugin to read in that manually updated epub and all was fine. No crashes.

In both cases, when I ran Sigil's Delete Unused Media tool, it said there were no unused media to delete. No crash or other issues at all.

Next, I started with a copy of skinny2.epub and again got the unmanifested files warning. Then I used Sigil's Add Existing to select the set of separate image files you provided. As expected it added these files to the opf manifest making the Unmanifested file warning go away. I then used Sigil's Delete Unused Media menu to remove them and no crash and again all was fine.

So how on earth did delete the original files skinny image files from epub in a way that actually did not physically remove the files but did remove their opf manifest entries to create skinny2.epub in the first place?

I hope you did not edit the opf file directly and just delete those lines! All you had to do was right click on the unwanted image files in Sigil's BookBrowser to remove them and it would have automatically properly updated the opf manifest.

In addition, directly accessing files inside Sigil's temp folder is a sure fire way to crash Sigil. Sigil manages those files and they can not be added to, modified or deleted without using Sigil.

So I am seeing no crashes. There really were unmanifested files stored in that epub that Sigil warned you about, that can be removed using a plugin or manually unzipping the epub and doing it youself. The question is how did you manage to remove the manifest entries and not the files themselves using Sigil. There should be no way for than to happen unless you hand edited the opf and did not use the tools Sigil provides to manage epub files.

So I am going to close this as not a bug. I would be happy to reopen it if you can explain how you generated that epub with unmanifested files using Sigil itself.

lenatime commented 1 year ago

I didn't even know to look at the 'opf' file until I got the error message. But, now that you mention it...though the images were not listed in the 'opf manifest,' I did move lines around (they seemed random). I take you are never ever to edit or change the 'opf' file?
Is that written in stone somewhere? I'm bad.

On 2023-09-30 08:12, Kevin Hendricks wrote:

Okay, using a copy of skinny2.epub, I opened it and received the "unmanifested files" warning.

First I started with a fresh copy of skinny2.epub and loaded it and got the unmanifested files warning, so I downloaded and installed Doitsu's useful "DeleteUnmanifestededFiles_v0.1.2.zip" Sigil plugin from Mobileread, ran it and again all was fine. No crashes with Delete Unused Media.

Next I took a copy of skinny2.epub and unzipped it manually and looked inside and sure enough those files were inside the unzipped epub and not listed in the opf manifest. I then manually deleted them from the unzipped epub folder. Then used Sigil's FolderIn plugin to read in that manually updated epub and all was fine. No crashes.

In both cases, when I ran Sigil's Delete Unused Media tool, it said there were no unused media to delete. No crash or other issues at all.

Next, I started with a copy of skinny2.epub and again got the unmanifested files warning. Then I used Sigil's Add Existing to select the set of separate image files you provided. As expected it added these files to the opf manifest making the Unmanifested file warning go away. I then used Sigil's Delete Unused Media menu to remove them and no crash and again all was fine.

So how on earth did delete the original files skinny image files from epub in a way that actually did not physically remove the files but did remove their opf manifest entries to create skinny2.epub in the first place?

I hope you did not edit the opf file directly and just delete those lines! All you had to do was right click on the unwanted image files in Sigil's BookBrowser to remove them and it would have automatically properly updated the opf manifest.

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>

Links:

[1] https://github.com/Sigil-Ebook/Sigil/issues/728#issuecomment-1741752600 [2] https://github.com/notifications/unsubscribe-auth/ACTEIJURZOFOBOZRZLV225DX5AEEVANCNFSM6AAAAAA5NHCVMA

kevinhendricks commented 1 year ago

Sigil tries to handle automatecreating the opf, so the end user never has to. Experts who understand the opf xml structure and meaning can edit it by hand. I just can't figure out how you can remove an opf manifest entry and not remove the actual file. Sigil will never do that itself.