lib/scrivito/link_parser.rb in scrivito_sdk-0.50.1 vs lib/scrivito/link_parser.rb in scrivito_sdk-0.60.0.rc1

- old
+ new

@@ -8,11 +8,11 @@ end def parse(url) uri = Addressable::URI.parse(url) - if (params = route(uri.to_s)) && params[:controller] == 'scrivito/ui' + if (params = sdk_route(uri.to_s)) && params[:controller] == 'scrivito/ui' uri.path = params[:application_path] end link_params = {} @@ -65,9 +65,14 @@ end def application_route?(uri) route_params = route(uri) route_params && route_params[:controller] == 'scrivito/cms_dispatch' + end + + def sdk_route(uri) + Scrivito::SdkEngine.routes.recognize_path(uri.to_s, method: :get) + rescue ActionController::RoutingError end def route(uri) Rails.application.routes.recognize_path(uri.to_s, method: :get) rescue ActionController::RoutingError