diff --git a/app/models/communication/website/git_file.rb b/app/models/communication/website/git_file.rb index 618f7c0aa2420307b1df0a79cf409a170a7cc4db..473dc535d702898a5f39227d4d3022182f66cf11 100644 --- a/app/models/communication/website/git_file.rb +++ b/app/models/communication/website/git_file.rb @@ -58,7 +58,7 @@ class Communication::Website::GitFile < ApplicationRecord end def path - @path ||= about.git_path(website) + @path ||= about.git_path(website)&.gsub(/\/+/, '/') end def sha diff --git a/app/services/git/repository.rb b/app/services/git/repository.rb index 3331a76c681d9625b1128ab0c8c8cbec92ddbdae..913b19fc3dcbe87aec82da3d9417135cf69bdc62 100644 --- a/app/services/git/repository.rb +++ b/app/services/git/repository.rb @@ -37,9 +37,9 @@ class Git::Repository def sync_git_files git_files.each do |file| if file.should_create? - provider.create_file sanitized_path(file.path), file.to_s + provider.create_file file.path, file.to_s elsif file.should_update? - provider.update_file sanitized_path(file.path), file.previous_path, file.to_s + provider.update_file file.path, file.previous_path, file.to_s elsif file.should_destroy? provider.destroy_file file.previous_path end @@ -48,11 +48,7 @@ class Git::Repository def mark_as_synced git_files.each do |git_file| - git_file.update previous_path: sanitized_path(git_file.path), previous_sha: git_file.sha + git_file.update previous_path: git_file.path, previous_sha: git_file.sha end end - - def sanitized_path(path) - path&.gsub(/\/+/, '/') - end end