mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-17 21:46:21 +00:00
fix: corregida condicion en metodo Rename en site_service.rb #13077
This commit is contained in:
parent
0071ab7328
commit
76e2fd8f60
1 changed files with 2 additions and 4 deletions
|
@ -89,15 +89,13 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
|
|
||||||
def rename(name)
|
def rename(name)
|
||||||
moved = false
|
moved = false
|
||||||
|
site.name = name
|
||||||
|
|
||||||
Site.transaction do
|
Site.transaction do
|
||||||
raise ActiveRecord::Rollback if site.path
|
raise ActiveRecord::Rollback if (site.path == site.path_was)
|
||||||
site.name = 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
|
moved = true
|
||||||
|
|
||||||
rescue StandardError
|
rescue StandardError
|
||||||
FileUtils.mv (site.path, site.path_was) if moved
|
FileUtils.mv (site.path, site.path_was) if moved
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in a new issue