[2.9] NEXUS-6537 Backport

Original PR
https://github.com/sonatype/nexus-oss/pull/553

Issue
https://issues.sonatype.org/browse/NEXUS-6537