mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-10-31 10:37:00 -04:00 
			
		
		
		
	Fix #316
This commit is contained in:
		
							parent
							
								
									9236b5a05a
								
							
						
					
					
						commit
						fea65749e6
					
				| @ -160,4 +160,4 @@ def sanitize_file_name(name): | ||||
|     Also remove path separators. ALl illegal characters are replaced by | ||||
|     underscores. | ||||
|     ''' | ||||
|     return re.sub(r'[:\?\\\/]|^-', '_', name.strip()) | ||||
|     return re.sub(r'[\|\~\:\?\\\/]|^-', '_', name.strip()) | ||||
| @ -20,7 +20,8 @@ from urllib import url2pathname | ||||
| from httplib import responses | ||||
| from optparse import OptionParser | ||||
| 
 | ||||
| from libprs500 import __version__, __appname__, __author__, setup_cli_handlers, browser | ||||
| from libprs500 import __version__, __appname__, __author__, setup_cli_handlers, \ | ||||
|                       browser, sanitize_file_name | ||||
| from libprs500.ebooks.BeautifulSoup import BeautifulSoup | ||||
| 
 | ||||
| class FetchError(Exception): | ||||
| @ -191,7 +192,7 @@ class RecursiveFetcher(object): | ||||
|                 self.logger.debug('Error: %s', str(err), exc_info=True) | ||||
|                 continue | ||||
|             c += 1 | ||||
|             imgpath = os.path.join(diskpath, 'img'+str(c)+ext) | ||||
|             imgpath = os.path.join(diskpath, sanitize_file_name('img'+str(c)+ext)) | ||||
|             self.imagemap[iurl] = imgpath | ||||
|             open(imgpath, 'wb').write(f.read()) | ||||
|             tag['src'] = imgpath | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user