##// END OF EJS Templates
files: prevent XSS in fake errors message on filenodes.
marcink -
r2160:844c2584 default
parent child Browse files
Show More
@@ -262,12 +262,14 b' class RepoFilesView(RepoAppView):'
262 commit_id, ext, fileformat, content_type = \
262 commit_id, ext, fileformat, content_type = \
263 self._get_archive_spec(fname)
263 self._get_archive_spec(fname)
264 except ValueError:
264 except ValueError:
265 return Response(_('Unknown archive type for: `{}`').format(fname))
265 return Response(_('Unknown archive type for: `{}`').format(
266 h.escape(fname)))
266
267
267 try:
268 try:
268 commit = self.rhodecode_vcs_repo.get_commit(commit_id)
269 commit = self.rhodecode_vcs_repo.get_commit(commit_id)
269 except CommitDoesNotExistError:
270 except CommitDoesNotExistError:
270 return Response(_('Unknown commit_id %s') % commit_id)
271 return Response(_('Unknown commit_id {}').format(
272 h.escape(commit_id)))
271 except EmptyRepositoryError:
273 except EmptyRepositoryError:
272 return Response(_('Empty repository'))
274 return Response(_('Empty repository'))
273
275
@@ -657,7 +659,7 b' class RepoFilesView(RepoAppView):'
657 try:
659 try:
658 dir_node = commit.get_node(f_path)
660 dir_node = commit.get_node(f_path)
659 except RepositoryError as e:
661 except RepositoryError as e:
660 return Response('error: {}'.format(safe_str(e)))
662 return Response('error: {}'.format(h.escape(safe_str(e))))
661
663
662 if dir_node.is_file():
664 if dir_node.is_file():
663 return Response('')
665 return Response('')
General Comments 0
You need to be logged in to leave comments. Login now