On 20.04.2010 10:48, Matteo Pelucco wrote:

On 19.04.2010 18:58, Matteo Pelucco wrote:

Hi all,
I think I've found a bug, present in Magnolia 4.1.
When we enables i18n, all links of a page accessed with a selector in
URL are "null".

e.g: URL like "/magnoliaAuthor/test.html" are OK
e.g: URL like "/magnoliaAuthor/test.123.html" are KO

The problem lies in these lines of code:

*** *** ***
ETK 1.1.2
ETKI18nContentSupport.java
*** *** ***

*** *** ***
@Override
protected String toI18NURI(String uri, Locale locale) {

String handle =
URI2RepositoryManager.getInstance().getHandle(MgnlContext.getAggregationState().getCurrentURI());

...
try {
content =
MgnlContext.getSystemContext().getHierarchyManager(repo).getContent(handle);

} catch (RepositoryException e) {
// ignore
return null;
}
*** *** ***

Replace the lines (A) with these (B) and all is back to work again..

*** A ***
String handle = URI2RepositoryManager.getInstance().getHandle(MgnlContext.getAggregationState().getCurrentURI()); String repo = URI2RepositoryManager.getInstance().getRepository(MgnlContext.getAggregationState().getCurrentURI());
*** end A ***

*** B ***
final String selector = MgnlContext.getAggregationState().getSelector();
final String currentURI = MgnlContext.getAggregationState().getCurrentURI();
        
String currentURIWithoutSelector = currentURI;
if (!StringUtils.isEmpty(selector)){
currentURIWithoutSelector = StringUtils.replace(currentURI, "." + selector, "");
}
        
String handle = URI2RepositoryManager.getInstance().getHandle(currentURIWithoutSelector); String repo = URI2RepositoryManager.getInstance().getRepository(currentURIWithoutSelector);
*** end B ***

HTH,
Matteo


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to