![]() |
#1 | ||
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Aug 2010
Location: Austria
Device: Onyx Boox AfterGlow C65ML
|
![]()
Today I noticed something strange - when I open one of my epubs in sigil 0.9.3 (or previously in 0.8.x) and check the content.opf the first lines look like this:
Quote:
Quote:
![]() I've attached an epub to show the problem (I've removed all picture and text files from the epub - so it's really small). Thanks for your help! ![]() Last edited by nalor78; 02-21-2016 at 03:57 PM. Reason: added sigil version |
||
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,370
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I see what you're saying saying with THAT epub. But I've never seen it happen with any other epub (v2 or v3) with Sigil 0.9.3. But then again, I've never opened any epubs with no text files. Will have to take a closer look.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Aug 2010
Location: Austria
Device: Onyx Boox AfterGlow C65ML
|
![]()
If you want I can send you the original epub, I just don't want to post it directly in public.
Sigil behaves exactly the same way with the original file - so I don't think it will make a big difference in the end. Thanks for looking into the issue! |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,370
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No thank you. I don't want a copy if it's a copyrighted book. There's a calibre plugin that will scramble the contents of an epub which will allow you to post a copy while avoiding any copyright issues. A scrambled version should allow us to see what's different about that epub. That would be my preference, if possible.
|
![]() |
![]() |
![]() |
#5 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,491
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Yes, definite bug in Sigil code here. It looks like a really old one as well.
This regular expression to fix xml declarations in ImportEPUB.cpp is not properly restricted and it is causing the problem: Code:
.//Misc/HTMLEncodingResolver.cpp:const QString VERSION_ATTRIBUTE = "version\\s*=\\s*(?:\"|')([^\"']+)(?:\"|')"; .//BookManipulation/XhtmlDoc.cpp:const int XML_DECLARATION_SEARCH_PREFIX_SIZE = 150; QString ImportEPUB::PrepareOPFForReading(const QString &source) { QString source_copy(source); QString prefix = source_copy.left(XML_DECLARATION_SEARCH_PREFIX_SIZE); QRegularExpression version(VERSION_ATTRIBUTE); QRegularExpressionMatch mo = version.match(prefix); // MASSIVE hack for XML 1.1 "support"; // this is only for people who specify // XML 1.1 when they actually only use XML 1.0 source_copy.replace(mo.capturedStart(), mo.capturedLength(), "version=\"1.0\""); return source_copy; } I will look into fixing this by restricting it to the xml declaration. Thanks for the bug report! KevinH Last edited by KevinH; 02-21-2016 at 08:51 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,491
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Hi All,
This bug is now fixed in Sigil master. It will hit any OPF file that does not start with an xml declaration line: Code:
<?xml version="1.0" encoding="utf-8" ?> This bug fix will appear in the next release. KevinH |
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,370
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Thanks Kevin!
I'm guessing this explains the post in the Sigil v0.9.3 release thread (which prompted the FixOPFv1 plugin) where people were running into opf package version "1.0" epubs (pre-existing epubs) so often. Sounds like this bug has been making people think there's way more plugins out there with incorrect package versions than there really are, for a very long time! |
![]() |
![]() |
![]() |
#8 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,491
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
Since the next release of Sigil is still weeks away (I have a lot of semantic and nav landmark changes to make yet), would you please modify your fixv1 plugin to change 1 to 2 as well as pass through version 2.0 and 3.0 unchanged but make sure you add a xml declaration heading to the opf file if it is missing. That will help people load in epubs not created in Sigil until we get a new release out. Either that or we can pull the Sigil-0.9.3 tag and add just the bug fixes and release a Sigil 0.9.3b version. Thanks! KevinH Quote:
|
|
![]() |
![]() |
![]() |
#9 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,370
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#10 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,491
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
Should we push out a Sigil-0.9.3b or Sigil-0.9.3v2 with just bug fixes out there? It might help reduce problems and future bug reports. Or I could back out my most recent changes and we could produce a Sigil-0.9.4 with those bug fixes and the new MetaEditor gui. Please let me know if you think either of these options would be better. Thanks, KevinH |
![]() |
![]() |
![]() |
#11 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,370
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,491
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
Sounds good to me! Thanks! KevinH Quote:
|
|
![]() |
![]() |
![]() |
#13 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Aug 2010
Location: Austria
Device: Onyx Boox AfterGlow C65ML
|
Thanks for the analysis and the quick fix!
(and just for the sake of completeness - I've found the calibre plugin and scrambled my book ![]() |
![]() |
![]() |
![]() |
#14 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,491
Karma: 5703586
Join Date: Nov 2009
Device: many
|
If you copy and rename your epub to end with .zip, unzip your epub and add the xml header declaration to your opf file, and rezip it, and rename it to .epub, you should load into Sigil just fine with nothing changing your package version any longer.
Either that or use DiapDealers new import plugin to load your epub. Once saved, you should not need to worry about using the plugi for that epub in the future as Sigil itlsef adds the required xml declaration heading. Please let us know if that doesn't do the trick. The real fix will appear in the next release. KevinH |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Comments in content.opf with Sigil 0.9.2 | turbulent | Sigil | 4 | 02-15-2016 05:29 PM |
avoiding Sigil's meta in content.opf | sbin | Sigil | 25 | 01-08-2016 03:51 PM |
Sigil 0.5.3 keeps rebuilding my content.opf file from scratch | mtrahan | Sigil | 7 | 04-28-2012 09:10 AM |
Sigil corrupting content.opf (0.4, 0.5) | cyana | Sigil | 21 | 02-11-2012 05:25 PM |
Sigil resets edits to content.opf | adv_dp_fan | Sigil | 7 | 09-28-2011 06:50 PM |