Skip to content

Commit

Permalink
Merge pull request #15836 from hellcp-work/files-url-generation
Browse files Browse the repository at this point in the history
Verify that the files we try to link to exist
  • Loading branch information
hennevogel committed Mar 20, 2024
2 parents 8591ec8 + 4cf17af commit 47542fa
Show file tree
Hide file tree
Showing 17 changed files with 3,958 additions and 1,891 deletions.
2 changes: 2 additions & 0 deletions src/api/app/components/sourcediff_tab_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def initialize(bs_request:, action:, active:, index:)

def file_view_path(filename, sourcediff)
return if sourcediff['files'][filename]['state'] == 'deleted'
return unless (source_package = Package.find_by_project_and_name(@action[:sprj], @action[:spkg]))
return unless source_package.file_exists?(filename, { rev: @action[:srev] }.compact)

diff_params = diff_data(@action[:type], sourcediff)
diff_params[:project_name] = diff_params[:project]
Expand Down
5 changes: 4 additions & 1 deletion src/api/app/views/webui/package/rdiff.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
- @filenames.each_with_index do |filename, index|
- revision = calculate_revision_on_state(@rev, @files[filename]['state'])
.mb-2
- file_exists = @package.file_exists?(filename, {rev: revision}.compact)
- file_view_path = file_exists ? project_package_file_path(project_name: @project, package_name: @package,
rev: revision, filename: filename) : nil
= render partial: 'revision_diff_detail',
locals: { file_view_path: project_package_file_path(project_name: @project, package_name: @package, rev: revision, filename: filename),
locals: { file_view_path: file_view_path,
filename: filename,
file: @files[filename],
index: index,
Expand Down
Loading

0 comments on commit 47542fa

Please sign in to comment.