5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-18 02:26:24 +00:00

fix: arreglado rescue que devuelve el repositorio a su estado original #13077
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
jazzari 2023-10-17 14:36:34 -03:00
parent 1675e32fe8
commit 7e0ab59ffa

View file

@ -88,14 +88,16 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
end end
def rename(name) def rename(name)
moved = false
Site.transaction do Site.transaction do
raise ActiveRecord::Rollback if site.path
site.name = name site.name = name
raise ActiveRecord::Rollback if File.exists?(name) FileUtils.mv (site.path_was, site.path) unless File.exists?(name)
FileUtils.mv site.path_was, site.path unless File.exists?(name)
ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name) ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name)
site.save site.save
moved = true
rescue StandardError rescue StandardError
FileUtils.mv site.path, site.path_was if File.exists?(name) FileUtils.mv (site.path, site.path_was) if moved
raise raise
end end
end end