From a94a23e9efae2b790e1ef682d570fe3e45a5edc6 Mon Sep 17 00:00:00 2001 From: George Schizas Date: Thu, 21 Nov 2019 22:40:34 +0200 Subject: [PATCH] Replace CRLF with LF on release files This resolves NEXUS-21834 which prevents APT repositories from working when running under Windows --- .../nexus/repository/apt/internal/hosted/AptHostedFacet.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/nexus-repository-apt/src/main/java/org/sonatype/nexus/repository/apt/internal/hosted/AptHostedFacet.java b/plugins/nexus-repository-apt/src/main/java/org/sonatype/nexus/repository/apt/internal/hosted/AptHostedFacet.java index 966e084004..05b788709e 100644 --- a/plugins/nexus-repository-apt/src/main/java/org/sonatype/nexus/repository/apt/internal/hosted/AptHostedFacet.java +++ b/plugins/nexus-repository-apt/src/main/java/org/sonatype/nexus/repository/apt/internal/hosted/AptHostedFacet.java @@ -172,11 +172,14 @@ public void rebuildIndexes(final List changes) throws IOException { releaseFile = buildReleaseFile(aptFacet.getDistribution(), store.getFiles().keySet(), md5Builder.toString(), sha256Builder.toString()); } + releaseFile = releaseFile.replace("\r", ""); aptFacet.put(releaseIndexName(RELEASE), new BytesPayload(releaseFile.getBytes(Charsets.UTF_8), AptMimeTypes.TEXT)); byte[] inRelease = signingFacet.signInline(releaseFile); + inRelease = new String(inRelease, Charsets.UTF_8).replace("\r", "").getBytes(); aptFacet.put(releaseIndexName(INRELEASE), new BytesPayload(inRelease, AptMimeTypes.TEXT)); byte[] releaseGpg = signingFacet.signExternal(releaseFile); + releaseGpg = new String(releaseGpg, Charsets.UTF_8).replace("\r", "").getBytes(); aptFacet.put(releaseIndexName(RELEASE_GPG), new BytesPayload(releaseGpg, AptMimeTypes.SIGNATURE)); }