From 70874af67e6c18adcde9b3bbfccf1d2684765748 Mon Sep 17 00:00:00 2001
From: tohosaku <tohosaku@users.osdn.me>
Date: Thu, 11 Jan 2024 01:34:42 +0000
Subject: [PATCH] Set either app/assets or assets as assets_dir

---
 lib/redmine/plugin_loader.rb | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/redmine/plugin_loader.rb b/lib/redmine/plugin_loader.rb
index 9fc634a6dd..c902336590 100644
--- a/lib/redmine/plugin_loader.rb
+++ b/lib/redmine/plugin_loader.rb
@@ -21,9 +21,11 @@ module Redmine
   class PluginPath
     attr_reader :assets_dir, :initializer
 
+    ASSET_PATHS = ['app/assets', 'assets']
+
     def initialize(dir)
       @dir = dir
-      @assets_dir = File.join dir, 'assets'
+      @assets_dir = find_assets_dir dir
       @initializer = File.join dir, 'init.rb'
     end
 
@@ -35,8 +37,18 @@ module Redmine
       @dir
     end
 
+    def find_assets_dir(dir)
+      paths = ASSET_PATHS.filter_map do |entry|
+        path = Pathname.new(dir).join(entry)
+        path if path.exist? && path.directory?
+      end
+      paths.first
+    end
+
     def has_assets_dir?
-      File.directory?(@assets_dir)
+      return false unless assets_dir
+
+      File.directory?(assets_dir)
     end
 
     def has_initializer?
-- 
2.39.2

