mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-04 03:27:00 -05:00 
			
		
		
		
	Fix #1163659 (Wrong filename output in error message when "Guide reference not found")
This commit is contained in:
		
							parent
							
								
									f3257d9865
								
							
						
					
					
						commit
						7076d8c2f5
					
				@ -333,8 +333,8 @@ class OEBReader(object):
 | 
				
			|||||||
        guide = self.oeb.guide
 | 
					        guide = self.oeb.guide
 | 
				
			||||||
        manifest = self.oeb.manifest
 | 
					        manifest = self.oeb.manifest
 | 
				
			||||||
        for elem in xpath(opf, '/o2:package/o2:guide/o2:reference'):
 | 
					        for elem in xpath(opf, '/o2:package/o2:guide/o2:reference'):
 | 
				
			||||||
            href = elem.get('href')
 | 
					            ref_href = elem.get('href')
 | 
				
			||||||
            path = urlnormalize(urldefrag(href)[0])
 | 
					            path = urlnormalize(urldefrag(ref_href)[0])
 | 
				
			||||||
            if path not in manifest.hrefs:
 | 
					            if path not in manifest.hrefs:
 | 
				
			||||||
                corrected_href = None
 | 
					                corrected_href = None
 | 
				
			||||||
                for href in manifest.hrefs:
 | 
					                for href in manifest.hrefs:
 | 
				
			||||||
@ -342,12 +342,12 @@ class OEBReader(object):
 | 
				
			|||||||
                        corrected_href = href
 | 
					                        corrected_href = href
 | 
				
			||||||
                        break
 | 
					                        break
 | 
				
			||||||
                if corrected_href is None:
 | 
					                if corrected_href is None:
 | 
				
			||||||
                    self.logger.warn(u'Guide reference %r not found' % href)
 | 
					                    self.logger.warn(u'Guide reference %r not found' % ref_href)
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
                href = corrected_href
 | 
					                ref_href = corrected_href
 | 
				
			||||||
            typ = elem.get('type')
 | 
					            typ = elem.get('type')
 | 
				
			||||||
            if typ not in guide:
 | 
					            if typ not in guide:
 | 
				
			||||||
                guide.add(typ, elem.get('title'), href)
 | 
					                guide.add(typ, elem.get('title'), ref_href)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _find_ncx(self, opf):
 | 
					    def _find_ncx(self, opf):
 | 
				
			||||||
        result = xpath(opf, '/o2:package/o2:spine/@toc')
 | 
					        result = xpath(opf, '/o2:package/o2:spine/@toc')
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user