wsgi: use data_files helper
	
		
			
	
		
	
	
		
	
		
			Some checks reported errors
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build was killed
				
			
		
		
	
	
				
					
				
			
		
			Some checks reported errors
		
		
	
	continuous-integration/drone/push Build was killed
				
			This commit is contained in:
		@@ -36,6 +36,7 @@ except ImportError:
 | 
				
			|||||||
from . import caching, crawler, readabilite
 | 
					from . import caching, crawler, readabilite
 | 
				
			||||||
from .morss import (DELAY, TIMEOUT, FeedFetch, FeedFormat, FeedGather,
 | 
					from .morss import (DELAY, TIMEOUT, FeedFetch, FeedFormat, FeedGather,
 | 
				
			||||||
                    MorssException, Options, log)
 | 
					                    MorssException, Options, log)
 | 
				
			||||||
 | 
					from .util import data_path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PORT = int(os.getenv('PORT', 8000))
 | 
					PORT = int(os.getenv('PORT', 8000))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -167,14 +168,8 @@ def cgi_file_handler(environ, start_response, app):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if re.match(r'^/?([a-zA-Z0-9_-][a-zA-Z0-9\._-]+/?)*$', url):
 | 
					    if re.match(r'^/?([a-zA-Z0-9_-][a-zA-Z0-9\._-]+/?)*$', url):
 | 
				
			||||||
        # if it is a legitimate url (no funny relative paths)
 | 
					        # if it is a legitimate url (no funny relative paths)
 | 
				
			||||||
        paths = [
 | 
					 | 
				
			||||||
            os.path.join(sys.prefix, 'share/morss/www', url),
 | 
					 | 
				
			||||||
            os.path.join(os.path.dirname(__file__), '../www', url)
 | 
					 | 
				
			||||||
            ]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for path in paths:
 | 
					 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
                f = open(path, 'rb')
 | 
					            f = open(data_path(url), 'rb')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        except IOError:
 | 
					        except IOError:
 | 
				
			||||||
            # problem with file (cannot open or not found)
 | 
					            # problem with file (cannot open or not found)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user