[MAGNOLIA-6882] Remove legacy code that allows to access site with duplicate prefix in the url Created: 03/Nov/16  Updated: 22/May/17  Resolved: 14/Dec/16

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 5.4, 5.5
Fix Version/s: 5.4.11, 5.5.1

Type: Bug Priority: Neutral
Reporter: Ondrej Chytil Assignee: Jaroslav Simak
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MULTISITE-11 Path handle is stripped twice thus ac... Closed
causality
caused by MAGNOLIA-4383 Images uploaded in fckEdit show 404 -... Closed
is causing MULTISITE-71 Multisite serves the root page only i... Closed
is causing MAGNOLIA-7040 When requesting an URI that starts wi... Closed
duplicate
is duplicated by MULTISITE-63 Using site A prefix + node path from ... Closed
is duplicated by MAGNOLIA-6388 Uri2RepositoryMapping.getHandle() all... Closed
relation
is related to MAGNOLIA-6243 Inline rich text links don't work on ... Closed
is related to MGNLDEMO-209 Client callback for travel-demo-pur y... Accepted
is related to MULTISITE-69 MultisteFilter cleanURI is not taking... Closed
supersession
supersedes MAGNOLIA-6176 Checking to see if prefix might have ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Kromeriz 74
Story Points: 3

 Description   

Can be seen on the travel demo project: https://demopublic.magnolia-cms.com/travel/travel
This can be reproduced only by manually accessing such URL or by creating such a link deliberately.

handle = cleanHandle(handle);

try {
    final Session session = MgnlContext.getJCRSession(this.repository);
    if (!session.itemExists(handle)) {
        String maybeHandle = (this.handlePrefix.endsWith("/") ? "/" : "") + StringUtils.removeStart(handle, this.handlePrefix);
        // prefix might have been prepended incorrectly. Second part of the condition is there to match links to binary nodes
        if (session.itemExists(maybeHandle) || (maybeHandle.lastIndexOf("/") > 0 && session.itemExists(StringUtils.substringBeforeLast(maybeHandle, "/")))) {
            return maybeHandle;
        }
    }
} catch (RepositoryException e) {
    //Log the exception and return handle
    log.debug(e.getMessage(), e);
}
return handle;

This code causes that the first /travel is cleared from the url and the result of that is that page that does not exist under path /travel/travel is served.



 Comments   
Comment by Milan Divilek [ 15/Dec/16 ]

Please during QA check all potentially duplicate tickets and link them with this ticket.
https://wiki.magnolia-cms.com/pages/viewpage.action?pageId=128519164

Comment by Philip Mundt [ 22/May/17 ]

Linking to MULTISITE-11, which removed (more or less) the exact same code from MultiSiteURI2RepositoryMapping.

Generated at Mon Feb 12 04:18:44 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.