From 76e2fd8f6072babcb05facc9d5741e3283b9c6c7 Mon Sep 17 00:00:00 2001 From: jazzari Date: Tue, 21 Nov 2023 13:59:02 +0100 Subject: [PATCH] fix: corregida condicion en metodo Rename en site_service.rb #13077 --- app/services/site_service.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 994b16d8..8cb012a0 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -89,15 +89,13 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do def rename(name) moved = false + site.name = name Site.transaction do - raise ActiveRecord::Rollback if site.path - site.name = name - FileUtils.mv (site.path_was, site.path) unless File.exists?(name) + raise ActiveRecord::Rollback if (site.path == site.path_was) ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name) site.save moved = true - rescue StandardError FileUtils.mv (site.path, site.path_was) if moved raise