diff options
author | Martin Stockhammer <martin_s@apache.org> | 2020-06-02 16:33:20 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2020-06-02 16:33:20 +0200 |
commit | 22a8cbfd22c8cfb33a8d4e3e82cf22a7c03df68b (patch) | |
tree | ff9558f4655cc13bd4b39505a69eabb0e8cf43f6 /archiva-modules/archiva-web/archiva-webdav | |
parent | 7219cf4ffcc9cba30c02fa421a1cdf9921839f33 (diff) | |
download | archiva-22a8cbfd22c8cfb33a8d4e3e82cf22a7c03df68b.tar.gz archiva-22a8cbfd22c8cfb33a8d4e3e82cf22a7c03df68b.zip |
Switching to layout interface
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 | 13 |
1 files changed, 8 insertions, 5 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 f10286339..fcc9c844b 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 @@ -66,6 +66,8 @@ import org.apache.archiva.repository.ReleaseScheme; import org.apache.archiva.repository.RepositoryGroup; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.RepositoryRequestInfo; +import org.apache.archiva.repository.content.Artifact; +import org.apache.archiva.repository.content.ContentItem; import org.apache.archiva.repository.storage.fs.FilesystemStorage; import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.metadata.audit.AuditListener; @@ -647,16 +649,17 @@ public class ArchivaDavResourceFactory if ( managedRepositoryContent.getRepository().getActiveReleaseSchemes().contains( ReleaseScheme.RELEASE ) && !repositoryRequestInfo.isMetadata( resourcePath ) && !repositoryRequestInfo.isSupportFile( resourcePath ) ) { - ArtifactReference artifact = null; + // ArtifactReference artifact = null; + Artifact artifact = null; try { BaseRepositoryContentLayout layout = managedRepositoryContent.getLayout( BaseRepositoryContentLayout.class ); - artifact = managedRepositoryContent.toArtifactReference( resourcePath ); - - if ( !VersionUtil.isSnapshot( artifact.getVersion() ) ) + ContentItem artifactItem = managedRepositoryContent.toItem( resourcePath ); + artifact = layout.adaptItem( Artifact.class, artifactItem ); + if ( !VersionUtil.isSnapshot( artifact.getVersion().getVersion() ) ) { // check if artifact already exists and if artifact re-deployment to the repository is allowed - if ( layout.hasContent( artifact ) + if ( artifactItem.exists() && managedRepositoryContent.getRepository().blocksRedeployments()) { log.warn( "Overwriting released artifacts in repository '{}' is not allowed.", |