[MGNLDMS-138] DMS 1.2.6 generated URLs not clean Created: 07/Oct/08  Updated: 03/Jul/14  Resolved: 14/Oct/08

Status: Closed
Project: Document Management System (closed)
Component/s: None
Affects Version/s: 1.2.6
Fix Version/s: 1.2.7, 1.3

Type: Bug Priority: Major
Reporter: Francis Pallini Assignee: Jan Haderka
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux dev.ecilia.fr 2.6.15-52-server #1 SMP Wed Aug 20 13:40:34 UTC 2008 i686 GNU/Linux
Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.2-01)
Java HotSpot(TM) Client VM (build Blackdown-1.4.2-01, mixed mode)


Issue Links:
Cloners
clones MAGNOLIA-2137 Downloading a document from DMS in FC... Closed
duplicate
is duplicated by MGNLDMS-163 wrong URL prefix Closed
relation
is related to MGNLDMS-126 DMS Module Makes Web Pages With "dms"... Closed
Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

Downloaded "magnolia-tomcat-bundle-3.6.3-bundle-jdk14.tar.gz"

Performed a clean install and then re-imported previous repositories (website and dms, but NOT config).

Then DMS URLs (wrapped into rendered texts) incorrectly contained double slashes (//) leading to 404 errors.

Tried with a new text and a new document at the root of DMS:

Test.pdf at the root of DMS -> URL = /dms//Test.pdf

Had to replace /server/URI2RepositoryMapping/mappings/dms/class in the config repository with a subclass of info.magnolia.module.dms.DMSURI2RepositoryMapping in order to provide a temporary workaround:

public class DMSURI2RepositoryMappingFix extends DMSURI2RepositoryMapping {

private String cleanHandle(String handle) {
if (handle.startsWith("/") == false)

{ handle = "/" + handle; }

handle = StringUtils.replace(handle, "//", "/");
return handle;
}

public String getHandle(String uri)

{ return cleanHandle(super.getHandle(uri)); }

public String getURI(UUIDLink uuidLink)

{ return cleanHandle(super.getURI(uuidLink)); }

}

Maybe another workaround would have been to remove trailing slash of /server/URI2RepositoryMapping/mappings/dms/URIPrefix but that didn't seem a clean solution to us.



 Comments   
Comment by Magnolia International [ 07/Oct/08 ]

The trailing slash in the mapping was in fact added to solve MGNLDMS-126

Comment by Jan Haderka [ 08/Oct/08 ]

I've fixed getURI in trunk and added test so it doesn't happen again.
As far as I can see getHandle() should not be affected once the getURI() was fixed as it only parses URI it got in a first place.

Comment by Francis Pallini [ 08/Oct/08 ]

As far as I know, DMS module is closed-source so we had no way of knowing that. As cleanHandle (copied from info.magnolia.cms.beans.config.URI2RepositoryMapping) seems harmless on correct URLs, we just duplicated the behavior exhibited by URI2RepositoryMapping (where cleanHandle is called just before return statement in both methods).

Comment by Magnolia International [ 08/Oct/08 ]

As far as I know, DMS module is closed-source

Where did you get that (wrong) idea from ??

http://svn.magnolia.info/svn/community/modules/magnolia-module-dms/

Comment by Jan Haderka [ 08/Oct/08 ]

we just duplicated the behavior exhibited by URI2RepositoryMapping (where cleanHandle is called just before return statement in both methods).

No big deal, I just wanted to be sure I didn't miss anything. If you did it just as a safety precaution, it is fine with me

Comment by Francis Pallini [ 08/Oct/08 ]

Nice to know that. Thanks!

Generated at Mon Feb 12 00:48:47 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.