From b256625132fefd7893b6149d1af6b6e4c77a0dd0 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 9 Dec 2013 02:46:56 +0000 Subject: [MRM-1761] Returned URL in search result does not work for SNAPSHOTS git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549368 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/webdav/ArchivaDavResourceFactory.java | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'archiva-modules/archiva-web/archiva-webdav') diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index 293e230e5..6132dfe01 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -527,6 +527,28 @@ public class ArchivaDavResourceFactory return path; } + private String evaluatePathWithVersion( ArchivaDavResourceLocator archivaLocator, ManagedRepositoryContent managedRepositoryContent ) + throws DavException + { + String layout = managedRepositoryContent.getRepository() == null ? new ManagedRepository( ).getLayout() : managedRepositoryContent.getRepository().getLayout(); + RepositoryStorage repositoryStorage = + this.applicationContext.getBean( "repositoryStorage#" + layout, RepositoryStorage.class ); + try + { + return repositoryStorage.getFilePathWithVersion( archivaLocator.getResourcePath(), managedRepositoryContent ); + } + catch ( LayoutException e ) + { + log.error( e.getMessage(), e ); + throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e ); + } + catch ( XMLException e ) + { + log.error( e.getMessage(), e ); + throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e ); + } + } + private DavResource processRepository( final DavServletRequest request, ArchivaDavResourceLocator archivaLocator, String activePrincipal, ManagedRepositoryContent managedRepositoryContent, ManagedRepository managedRepository ) @@ -535,7 +557,8 @@ public class ArchivaDavResourceFactory DavResource resource = null; if ( isAuthorized( request, managedRepositoryContent.getId() ) ) { - String path = getLogicalResource( archivaLocator, managedRepository, false ); + // Maven Centric part ask evaluation if -SNAPSHOT + String path = evaluatePathWithVersion(archivaLocator, managedRepositoryContent); if ( path.startsWith( "/" ) ) { path = path.substring( 1 ); -- cgit v1.2.3