Skip to content

Commit d4f6a61

Browse files
authored
fix: allow smart action endpoints to start with slashes
2 parents 06dcde7 + cf6c6a9 commit d4f6a61

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

app/controllers/forest_liana/smart_actions_controller.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,8 @@ def find_resource(collection_name)
5757

5858
# smart action permissions are retrieved from the action's endpoint and http_method
5959
def get_smart_action_request_info
60-
endpoint = request.fullpath
61-
# Trim starting '/'
62-
endpoint[0] = '' if endpoint[0] == '/'
6360
{
64-
endpoint: endpoint,
61+
endpoint: request.fullpath,
6562
http_method: request.request_method
6663
}
6764
end

app/services/forest_liana/utils/beta_schema_utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def self.find_action_from_endpoint(collection_name, endpoint, http_method)
66

77
return nil unless collection
88

9-
collection.actions.find { |action| action.endpoint == endpoint && action.http_method == http_method }
9+
collection.actions.find { |action| (action.endpoint == endpoint || "/#{action.endpoint}" == endpoint) && action.http_method == http_method }
1010
end
1111
end
1212
end

0 commit comments

Comments
 (0)