diff --git a/modules/node/handler/cms_node_type_webform_manager.e b/modules/node/handler/cms_node_type_webform_manager.e index 221cfee..2adf41f 100644 --- a/modules/node/handler/cms_node_type_webform_manager.e +++ b/modules/node/handler/cms_node_type_webform_manager.e @@ -122,8 +122,10 @@ feature -- Forms ... else -- TODO: implement full path alias validation end - if attached a_response.api.location_alias (f_path_alias) as l_aliased_location then - fd.report_invalid_field ("path_alias", "Path is already aliazed to location %"" + l_aliased_location + "%" !") + if + attached a_response.api.source_of_path_alias (f_path_alias) as l_aliased_location + then + fd.report_invalid_field ("path_alias", "Path is already aliased to location %"" + a_response.link (Void, l_aliased_location, Void) + "%" !") end end end(?, response) diff --git a/src/service/cms_api.e b/src/service/cms_api.e index 771e705..977148a 100644 --- a/src/service/cms_api.e +++ b/src/service/cms_api.e @@ -326,18 +326,17 @@ feature -- Path aliases end end - source_of_path_alias (a_alias: READABLE_STRING_8): READABLE_STRING_8 + source_of_path_alias (a_alias: READABLE_STRING_8): detachable READABLE_STRING_8 -- Resolved path for alias `a_alias'. --| the CMS supports aliases for path, and then this function simply returns --| the effective target path/url for this `a_alias'. --| For instance: articles/2015/may/this-is-an-article can be an alias to node/123 --| This function will return "node/123". --| If the alias is bad (i.e does not alias real path), then this function - --| returns the alias itself. + --| returns Void. do - Result := a_alias - if attached storage.source_of_path_alias (Result) as l_path then - Result := l_path + if attached storage.source_of_path_alias (a_alias) as l_source_path then + Result := l_source_path end end diff --git a/src/service/path/cms_router.e b/src/service/path/cms_router.e index ce1982e..081902d 100644 --- a/src/service/path/cms_router.e +++ b/src/service/path/cms_router.e @@ -38,7 +38,11 @@ feature {WSF_ROUTER_MAPPING} -- Dispatch helper if not l_path.is_empty and l_path [1] = '/' then l_path.remove_head (1) end - Result := api.source_of_path_alias (l_path) + if attached api.source_of_path_alias (l_path) as l_aliased_path then + Result := l_aliased_path + else + Result := l_path + end if Result.is_empty then Result := "/" elseif Result [1] /= '/' then @@ -49,4 +53,7 @@ feature {WSF_ROUTER_MAPPING} -- Dispatch helper end end +note + copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" + license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" end