diff options
author | Olivier Lamy <olamy@apache.org> | 2013-12-09 02:46:56 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2013-12-09 02:46:56 +0000 |
commit | b256625132fefd7893b6149d1af6b6e4c77a0dd0 (patch) | |
tree | f8223392c381aff850081156d15d25dc8b0de85e /archiva-modules/archiva-web/archiva-webdav | |
parent | 978ab1446b07ede86c1f4e5dbc277e9b476a4c3e (diff) | |
download | archiva-b256625132fefd7893b6149d1af6b6e4c77a0dd0.tar.gz archiva-b256625132fefd7893b6149d1af6b6e4c77a0dd0.zip |
[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
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java | 25 |
1 files changed, 24 insertions, 1 deletions
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 ); |