File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -95,13 +95,15 @@ def __send_api_file(self, file_name):
9595 with codecs .open (file_name , 'r' , 'utf-8' ) as file :
9696 data = file .read ()
9797
98- # replaces the hard coded url by the
99- # current url.
98+ # replaces the hard coded url by the current url.
10099 api_project = self .__read_api_project ()
101100
102- new_url = request .url_root .strip ('/' )
103- old_url = api_project .get ('url' , new_url )
104- data = data .replace (old_url , new_url )
101+ old_url = api_project .get ('url' )
102+
103+ # replaces the project's url only if it is present in the file.
104+ if old_url :
105+ new_url = request .url_root .strip ('/' )
106+ data = data .replace (old_url , new_url )
105107
106108 # creates a flask response to send
107109 # the file to the browser
You can’t perform that action at this time.
0 commit comments