NEXUS-6139: Backport to Nexus 2.7.x

Backported fixes from master to 2.7.x

Pull requests
https://github.com/sonatype/nexus-oss/pull/262
https://github.com/sonatype/nexus-oss/pull/286

Issue
https://issues.sonatype.org/browse/NEXUS-6139
Merge remote-tracking branch 'origin/nexus-2.7.x' into nexus-2.7.x-NEXUS-6139
Merge pull request #329 from sonatype/nexus-2.7.x-NEXUS-6139

[2.7.x] NEXUS-6139: Backport to Nexus 2.7.x