Skip to content

Commit

Permalink
Fixed 500 error for GitHub finding links (#6981)
Browse files Browse the repository at this point in the history
* Typo on auto_create_context (#6291)

* Fixed 500 error for GitHub finding links

Co-authored-by: Bastian Hodapp <[email protected]>
  • Loading branch information
blakeaowens and Bassadin authored Oct 13, 2022
1 parent cf57857 commit 4ac5413
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2802,13 +2802,18 @@ def get_file_path_with_link(self):
return None
if self.test.engagement.source_code_management_uri is None:
return escape(self.file_path)
link = self.test.engagement.source_code_management_uri
if "https://github.com/" in self.test.engagement.source_code_management_uri:
if self.test.engagement.commit_hash is not None:
link = self.test.engagement.source_code_management_uri + '/blob/' + self.test.engagement.commit_hash + '/' + self.file_path
if self.test.commit_hash is not None:
link += '/blob/' + self.test.commit_hash + '/' + self.file_path
elif self.test.engagement.commit_hash is not None:
link += '/blob/' + self.test.engagement.commit_hash + '/' + self.file_path
elif self.test.branch_tag is not None:
link += '/blob/' + self.test.branch_tag + '/' + self.file_path
elif self.test.engagement.branch_tag is not None:
link = self.test.engagement.source_code_management_uri + '/blob/' + self.test.engagement.branch_tag + '/' + self.file_path
link += '/blob/' + self.test.engagement.branch_tag + '/' + self.file_path
else:
link = self.test.engagement.source_code_management_uri + '/' + self.file_path
link += '/' + self.file_path
if self.line:
link = link + '#L' + str(self.line)
return create_bleached_link(link, self.file_path)
Expand Down

0 comments on commit 4ac5413

Please sign in to comment.