On 03/22/2018 01:53 PM, Cris Fuhrman wrote: > I'm testing 2.3.0 on my Ubuntu VM (didn't want to break my Windows > install) with a document that has a lot of PlantUML files (which have > a custom conversion rule to SVG that works well most of the time). > > One of the files has some embedded HTML in it, and LyX seems to decide > (despite the .plantuml extension and conversion rule) to process it > has an html_table extension. > > I tracked down the log messages whenever I try to reload the image. > Note the fact that it gets some mime type of *text/html* and having > determined the content, it ignores the extension (and thus the rule). > This seems like a bug. > > 13:38:01.770: (graphics-reload)graphics/GraphicsCacheItem.cpp > (421): Converting it to format. > graphics/GraphicsCacheItem.cpp (391): > [CacheItem::Impl::convertToDisplayFormat] > Attempting to convert image file: > > /home/cfuhrman/Documents/mgl843-notes-de-cours/figures/RFC_example.plantuml > with displayed filename: > ~/Documents/mgl843-notes-de-cours/figures/RFC_example.plantuml > Format.cpp (438): got format from MIME type: text/html -> html_table > > > Here's what a successful reload of a .plantuml image reloads as. > You'll note that the *getFormatFromContents* first fails before it > uses the file extension: > > 13:47:50.702: (graphics-reload)graphics/GraphicsCacheItem.cpp > (421): Converting it to format. > graphics/GraphicsCacheItem.cpp (391): > [CacheItem::Impl::convertToDisplayFormat] > Attempting to convert image file: > /home/cfuhrman/Documents/mgl843-notes-de-cours/figures/RFC_class.plantuml > with displayed filename: > ~/Documents/mgl843-notes-de-cours/figures/RFC_class.plantuml > Format.cpp (389): filetools(getFormatFromContents) > File type not recognised before EOF! > Format.cpp (396): filetools(getFormatFromContents) > Couldn't find a known format! > Format.cpp (507): will guess format from file extension: plantuml > -> PlantUML > graphics/GraphicsCacheItem.cpp (398): > The file contains PlantUML format data. > graphics/GraphicsCacheItem.cpp (347): Unable to convert from > PlantUML to bmp > graphics/GraphicsCacheItem.cpp (347): Unable to convert from > PlantUML to gif > graphics/GraphicsCacheItem.cpp (347): Unable to convert from > PlantUML to jpg > graphics/GraphicsCacheItem.cpp (347): Unable to convert from > PlantUML to pbm > graphics/GraphicsCacheItem.cpp (347): Unable to convert from > PlantUML to pgm > graphics/GraphicsCacheItem.cpp (410): No conversion needed (file > in file cache)! > graphics/GraphicsCacheItem.cpp (301): Loading image. > graphics/GraphicsCacheItem.cpp (307): Image loading succeeded. > > > Is this a bug or a feature? How can I force LyX not to try to be smart > about the file content? This problem didn't happen on Windows 10 with > 2.2.x.
Hard to say. It looks to me as if maybe there is a difference between 2.2.x and 2.3.0 in whether it was packed with the "magic" mime-type library. The magic-related code seems to have been skipped in the 2.2.x version. In any event, this looks like a bug in the magic library. That's where we are getting the file type from. How to avoid it? That I do not know. Riki