mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-18 06:26:22 +00:00
fix: agregado bloque de excepción en metodo rename #13077
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
5fbb276f71
commit
1675e32fe8
1 changed files with 5 additions and 1 deletions
|
@ -90,9 +90,13 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
def rename(name)
|
def rename(name)
|
||||||
Site.transaction do
|
Site.transaction do
|
||||||
site.name = name
|
site.name = name
|
||||||
FileUtils.mv site.path_was, site.path(name: name)
|
raise ActiveRecord::Rollback if 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
|
||||||
|
rescue StandardError
|
||||||
|
FileUtils.mv site.path, site.path_was if File.exists?(name)
|
||||||
|
raise
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue