mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-10-31 10:37:00 -04:00 
			
		
		
		
	Handle lit files with the ampersand character in the names of constituent files.
This commit is contained in:
		
							parent
							
								
									32f2e3c03d
								
							
						
					
					
						commit
						88055d3e7b
					
				| @ -250,7 +250,6 @@ class HTMLConverter(object): | |||||||
|          |          | ||||||
|         paths = [os.path.abspath(path) for path in paths] |         paths = [os.path.abspath(path) for path in paths] | ||||||
|          |          | ||||||
|          |  | ||||||
|         while len(paths) > 0 and self.link_level <= self.link_levels: |         while len(paths) > 0 and self.link_level <= self.link_levels: | ||||||
|             for path in paths: |             for path in paths: | ||||||
|                 if path in self.processed_files: |                 if path in self.processed_files: | ||||||
| @ -346,7 +345,9 @@ class HTMLConverter(object): | |||||||
|          |          | ||||||
|         self.file_name = os.path.basename(path) |         self.file_name = os.path.basename(path) | ||||||
|         self.logger.info('Processing %s', path if self.verbose else self.file_name) |         self.logger.info('Processing %s', path if self.verbose else self.file_name) | ||||||
|         upath = path.encode('utf-8') if isinstance(path, unicode) else path  |         upath = path.encode('utf-8') if isinstance(path, unicode) else path | ||||||
|  |         if not os.path.exists(upath): | ||||||
|  |             upath = upath.replace('&', '%26') #convertlit replaces & with %26 in file names  | ||||||
|         raw = open(upath, 'rb').read() |         raw = open(upath, 'rb').read() | ||||||
|         soup = self.preprocess(raw) |         soup = self.preprocess(raw) | ||||||
|         self.logger.info('\tConverting to BBeB...') |         self.logger.info('\tConverting to BBeB...') | ||||||
|  | |||||||
| @ -65,7 +65,7 @@ def process_file(path, options, logger=None): | |||||||
|         if opf: |         if opf: | ||||||
|             path = opf[0] |             path = opf[0] | ||||||
|             opf = OPFReader(path) |             opf = OPFReader(path) | ||||||
|             htmlfile = opf.spine.items().next().href |             htmlfile = opf.spine.items().next().href.replace('&', '%26') #convertlit replaces & with %26 | ||||||
|             options.opf = path |             options.opf = path | ||||||
|         else:     |         else:     | ||||||
|             l = glob.glob(os.path.join(tdir, '*toc*.htm*')) |             l = glob.glob(os.path.join(tdir, '*toc*.htm*')) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user