Sigil-Ebook / PageEdit

ePub XHTML Visual Editor
GNU General Public License v3.0
245 stars 28 forks source link

PageEdit fail to insert an existing image/video/audio file properly from Sigil #38

Closed coder168 closed 5 months ago

coder168 commented 5 months ago

When insert an existing image/video/audio by the button "insert an exisitng image video audio file", PageEdit can insert the selected file, but the resulted image link does not work properly, their "src" attributes point to invalid values, eg:

 <img alt="image name" src="////////////////////////"/>
 <audio controls="controls" src="////////////////////////////////////////"></audio>
 <video controls="controls" src="///////////////////////////////////"></video>

Sigil has an similar button, it works fine, the resulted image/video/audio links point to the correct files selected and works properly. It is little annoying that you have to switch back and forth between Sigil and PageEdit for properly file insertion.

kevinhendricks commented 5 months ago

In what exact way is it messing up the src urls? Please provide a specific src url inserted by PageEdit and the exact same correct url inserted by Sigil so we can see what might be broken. Is one relative to the epub root? Or relative to the opf and not relative to the xhtml file it was inserted in? Is case messed up?

Some more info would certainly help narrow it down as to where to start looking

Obviously this behaviour was not intended. But, fyi, PageEdit is really designed for minor editing and not meant to be the standard workhorse for epub editing as live editing with PageEdit can create some very poorly formatted xhtml.

kevinhendricks commented 5 months ago

Okay I see, you did give me specific urls.

Here is some debug output:

Debug: currentpath: "/Users/kbhend/Desktop/test/OEBPS/Text/about_epub.xhtml" Debug: mediapath: "/Users/kbhend/Desktop/test/OEBPS/Images/ui_toc-tabbed.png" Debug: mkind: "image" Debug: relative_link: "../Images/ui_toc-tabbed.png" Debug: after URLEncoding: "???????????????????????????"

For some reason the The URLEncodedPath when passed in a normal relative path is coming back with complete garbage. That must be due to some change possibly by Qt.

I will try to track that down and get a fix in place for the next release.

kevinhendricks commented 5 months ago

Yes, the URLEncodePath routine got stepped on when we merged in Qt6 support by mistake. It has now been fixed and the fix pushed to PageEdit master repo.

This fix will be included in our next release.

If you build your own from source, feel free to use PageEdit to get the fix now as PageEdit code is otherwise quite stable.

Thank you for your bug report.

kevinhendricks commented 5 months ago

FYI, if are willing to test a pre-release CI build please let me know your platform and I can post one for you to download and use.

coder168 commented 5 months ago

Thank @kevinhendricks for lighting fast support! 👍 👏 ㊗️

I am OK to waiting for the next official release.