Skip to content

Commit

Permalink
Fixed safe_load_path? method definition to avoid runtime errors (#4157)
Browse files Browse the repository at this point in the history
  • Loading branch information
abujeda authored Feb 17, 2025
1 parent a3c791e commit 3dc422e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/dashboard/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class Application < Rails::Application
config.paths["app/views"].unshift ::Configuration.config_root.join("views").to_s
end

# Determine if this path is safe to load. I.e., are all the files root owned.
def safe_load_path?(path)
path.exists? && path.children.all? { |f| File.stat(f).uid.zero? }
end

# Enable installed plugins only if configured by administrator
plugins_dir = Pathname.new(::Configuration.plugins_directory)
if plugins_dir.directory?
Expand All @@ -69,10 +74,5 @@ class Application < Rails::Application
config.paths["app/views"].unshift(views.to_s) if safe_load_views
end
end

# Determine if this path is safe to load. I.e., are all the files root owned.
def safe_load_path?(path)
path.children.all? { |f| File.stat(f).uid.zero? }
end
end
end

0 comments on commit 3dc422e

Please sign in to comment.