Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: The warning about unrecognized media types cannot be dismissed because there are too many files. #791

Closed
zhao-wuyan opened this issue Jan 21, 2025 · 7 comments
Labels

Comments

@zhao-wuyan
Copy link

Bug Description

Image
I edited a converted EPUB file, but when I opened it, I was greeted with a barrage of warning pop-ups. I couldn't do anything except click "OK" or "Close" repeatedly. With over 400 pages, I pressed the Enter key for several minutes and the pop-ups just wouldn't stop.

Platform (OS)

Windows (Default)

OS Version / Specifics

windows11

What version of Sigil are you using?

current

Any backtraces or crash reports

@zhao-wuyan zhao-wuyan added the bug label Jan 21, 2025
@kevinhendricks
Copy link
Contributor

I will look into creating an abort to a load. But incorrect media types should be very very rare as the list of recognized media types is given right in the epub spec.

Please post a copy of the OPF here so we can see what incorrect media type is being used so often.

@kevinhendricks
Copy link
Contributor

Just to verify, is this with the just released Sigil-2.4.0? The code that implements load warnings was recently changed.

@zhao-wuyan
Copy link
Author

zhao-wuyan commented Jan 21, 2025

只是为了验证,这是刚刚发布的 Sigil-2.4.0 吗?最近更改了实现加载警告的代码。

yes,It was just downloaded.

Image

test.zip

@zhao-wuyan
Copy link
Author

只是为了验证,这是刚刚发布的 Sigil-2.4.0 吗?最近更改了实现加载警告的代码。

是的,它只是下载了

test.zip

These are two articles I exported casually. This EPUB was converted from HTML using other software.

@kevinhendricks
Copy link
Contributor

kevinhendricks commented Jan 21, 2025

Whatever you created is NOT an epub. Files are missing file extensions and media-types are explicitly left blank.

Archive: test.epub
extracting: mimetype
creating: OEBPS/
inflating: OEBPS/style.css
inflating: OEBPS/29fc733e-0ec4-495d-8e68-d9e59f416b0d.xhtml
inflating: OEBPS/d1b8af2a-1432-4cf4-9181-206133a5edcc.xhtml
creating: META-INF/
inflating: META-INF/container.xml
inflating: OEBPS/content.opf
inflating: OEBPS/toc.ncx
inflating: OEBPS/toc.xhtml
creating: OEBPS/images/
inflating: OEBPS/images/fa6719d4-a53b-41e6-b49a-811e270f3cfb.
inflating: OEBPS/images/35b4972e-e75a-4e9a-a0c0-36930fed844b.
inflating: OEBPS/images/f9f3e496-a5b2-4c5b-bc58-83b621303820.
inflating: OEBPS/images/e198e6fe-9c9d-47d9-9fd6-9d697bc463b7.
inflating: OEBPS/images/8419748b-317c-418e-83e8-f38e1a504399.
inflating: OEBPS/images/8bb1b6a7-19a8-48c6-a523-60af838c8cbc.
inflating: OEBPS/images/914b572b-5694-4272-972b-a52d79256e8c.
inflating: OEBPS/images/437d9c46-61ed-4509-8c22-d798b120163c.
inflating: OEBPS/images/71e9eaa5-51b9-4fff-857e-09d3d79f6cd1.
inflating: OEBPS/images/b8bb414f-4f67-43cd-9702-427c7c6dd951.
inflating: OEBPS/images/0c0c1802-d18f-444b-8e3f-3779a3e77882.
inflating: OEBPS/images/4e396bed-de8d-4831-b7c3-0de041c8c335.
inflating: OEBPS/images/ade2d350-b099-42f1-86ed-3df9298fa945.
inflating: OEBPS/images/8ee7d498-f2d4-428e-b13a-ab6fb84e9f88.
inflating: OEBPS/images/5a1c0730-83aa-4438-b736-e3194f2a0093.
inflating: OEBPS/images/ce5b7589-7789-4ceb-b6bd-8d7ca310a7df.
inflating: OEBPS/images/50d12305-cf90-4159-9755-b074149b5815.
inflating: OEBPS/images/b74ee469-ab05-4a41-8534-0397f9f7445d.
inflating: OEBPS/images/830ec949-c582-44a7-8df1-86dcec3291fb.
inflating: OEBPS/images/237c0cee-d0b6-4759-925d-3ba8f28db102.
inflating: OEBPS/images/e26a5d6b-86e0-4714-899d-ca2e923a5333.
inflating: OEBPS/images/c82e104e-e401-4b71-b983-1fdf212e43e7.
inflating: OEBPS/images/3b96d627-3e12-4570-9beb-cec312226f74.
inflating: OEBPS/images/7a845c24-3d55-4e1a-927c-e674b3f547fa.

And from the content.opf manifest there are missing media-types:

    <item id="image_0" href="images/fa6719d4-a53b-41e6-b49a-811e270f3cfb." media-type="" />
    <item id="image_1" href="images/35b4972e-e75a-4e9a-a0c0-36930fed844b." media-type="" />
    <item id="image_2" href="images/f9f3e496-a5b2-4c5b-bc58-83b621303820." media-type="" />
    <item id="image_3" href="images/e198e6fe-9c9d-47d9-9fd6-9d697bc463b7." media-type="" />
    <item id="image_4" href="images/8419748b-317c-418e-83e8-f38e1a504399." media-type="" />
    <item id="image_5" href="images/8bb1b6a7-19a8-48c6-a523-60af838c8cbc." media-type="" />
    <item id="image_6" href="images/914b572b-5694-4272-972b-a52d79256e8c." media-type="" />
    <item id="image_7" href="images/437d9c46-61ed-4509-8c22-d798b120163c." media-type="" />
    <item id="image_8" href="images/71e9eaa5-51b9-4fff-857e-09d3d79f6cd1." media-type="" />
    <item id="image_9" href="images/b8bb414f-4f67-43cd-9702-427c7c6dd951." media-type="" />
    <item id="image_10" href="images/0c0c1802-d18f-444b-8e3f-3779a3e77882." media-type="" />
    <item id="image_11" href="images/4e396bed-de8d-4831-b7c3-0de041c8c335." media-type="" />
    <item id="image_12" href="images/ade2d350-b099-42f1-86ed-3df9298fa945." media-type="" />
    <item id="image_13" href="images/8ee7d498-f2d4-428e-b13a-ab6fb84e9f88." media-type="" />
    <item id="image_14" href="images/5a1c0730-83aa-4438-b736-e3194f2a0093." media-type="" />
    <item id="image_15" href="images/ce5b7589-7789-4ceb-b6bd-8d7ca310a7df." media-type="" />
    <item id="image_16" href="images/50d12305-cf90-4159-9755-b074149b5815." media-type="" />
    <item id="image_17" href="images/b74ee469-ab05-4a41-8534-0397f9f7445d." media-type="" />
    <item id="image_18" href="images/830ec949-c582-44a7-8df1-86dcec3291fb." media-type="" />

So you should instead file a bug report with:
<meta name="generator" content="epub-gen" />
the epub-gen creators and point out their epub generator is very very broken.

Sigil is an epub editor, not an editor for crap just called "an epub" without it meeting any of the basic structure of the epub specifiication.

So I am closing this as not a bug as missing media-type values for files without file extensions are very rare meaning that user's of Sigil should never have to deal with this when actually editing real epubs.

Maybe in a future release we will add a skip or abort warnings capabilities, but for the foreseeable future this is really not needed.

@kevinhendricks
Copy link
Contributor

You might want to point out to the epub-gen npm crowd that looking for magic bytes at the start of files and mapping them to image types would certainly help to create a more proper content.opf:

cp OEBPS/images
cp ~/Desktop/imghdr.py ./
python3 ./imghdr.py
./: recursing down:
./fa6719d4-a53b-41e6-b49a-811e270f3cfb.: png
./3b96d627-3e12-4570-9beb-cec312226f74.: png
./50d12305-cf90-4159-9755-b074149b5815.: webp
./8419748b-317c-418e-83e8-f38e1a504399.: png
./e198e6fe-9c9d-47d9-9fd6-9d697bc463b7.: png
./914b572b-5694-4272-972b-a52d79256e8c.: png
./ade2d350-b099-42f1-86ed-3df9298fa945.: png
./c82e104e-e401-4b71-b983-1fdf212e43e7.: png
./4e396bed-de8d-4831-b7c3-0de041c8c335.: png
./237c0cee-d0b6-4759-925d-3ba8f28db102.: png
./b74ee469-ab05-4a41-8534-0397f9f7445d.: png
./8ee7d498-f2d4-428e-b13a-ab6fb84e9f88.: png
./b8bb414f-4f67-43cd-9702-427c7c6dd951.: png
./830ec949-c582-44a7-8df1-86dcec3291fb.: png
./35b4972e-e75a-4e9a-a0c0-36930fed844b.: gif
./0c0c1802-d18f-444b-8e3f-3779a3e77882.: png
./437d9c46-61ed-4509-8c22-d798b120163c.: png
./f9f3e496-a5b2-4c5b-bc58-83b621303820.: png
./8bb1b6a7-19a8-48c6-a523-60af838c8cbc.: png
./ce5b7589-7789-4ceb-b6bd-8d7ca310a7df.: png
./71e9eaa5-51b9-4fff-857e-09d3d79f6cd1.: png
./7a845c24-3d55-4e1a-927c-e674b3f547fa.: png
./e26a5d6b-86e0-4714-899d-ca2e923a5333.: png
./5a1c0730-83aa-4438-b736-e3194f2a0093.: png

The content.opf should have included the proper media-type in the manifest for each file. That is required in both epub2 and epub3 specifications. And without a proper file extension, Sigil can not easily guess and would have to probe each and every file before trying to load the correct type of resource.

@zhao-wuyan
Copy link
Author

You might want to point out to the epub-gen npm crowd that looking for magic bytes at the start of files and mapping them to image types would certainly help to create a more proper content.opf:

cp OEBPS/images
cp ~/Desktop/imghdr.py ./
python3 ./imghdr.py
./: recursing down:
./fa6719d4-a53b-41e6-b49a-811e270f3cfb.: png
./3b96d627-3e12-4570-9beb-cec312226f74.: png
./50d12305-cf90-4159-9755-b074149b5815.: webp
./8419748b-317c-418e-83e8-f38e1a504399.: png
./e198e6fe-9c9d-47d9-9fd6-9d697bc463b7.: png
./914b572b-5694-4272-972b-a52d79256e8c.: png
./ade2d350-b099-42f1-86ed-3df9298fa945.: png
./c82e104e-e401-4b71-b983-1fdf212e43e7.: png
./4e396bed-de8d-4831-b7c3-0de041c8c335.: png
./237c0cee-d0b6-4759-925d-3ba8f28db102.: png
./b74ee469-ab05-4a41-8534-0397f9f7445d.: png
./8ee7d498-f2d4-428e-b13a-ab6fb84e9f88.: png
./b8bb414f-4f67-43cd-9702-427c7c6dd951.: png
./830ec949-c582-44a7-8df1-86dcec3291fb.: png
./35b4972e-e75a-4e9a-a0c0-36930fed844b.: gif
./0c0c1802-d18f-444b-8e3f-3779a3e77882.: png
./437d9c46-61ed-4509-8c22-d798b120163c.: png
./f9f3e496-a5b2-4c5b-bc58-83b621303820.: png
./8bb1b6a7-19a8-48c6-a523-60af838c8cbc.: png
./ce5b7589-7789-4ceb-b6bd-8d7ca310a7df.: png
./71e9eaa5-51b9-4fff-857e-09d3d79f6cd1.: png
./7a845c24-3d55-4e1a-927c-e674b3f547fa.: png
./e26a5d6b-86e0-4714-899d-ca2e923a5333.: png
./5a1c0730-83aa-4438-b736-e3194f2a0093.: png

The content.opf should have included the proper media-type in the manifest for each file. That is required in both epub2 and epub3 specifications. And without a proper file extension, Sigil can not easily guess and would have to probe each and every file before trying to load the correct type of resource.

OK. Thank you for your answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants