Skip to content

Commit

Permalink
Merge branch '3.2.x'
Browse files Browse the repository at this point in the history
Closes gh-39794
  • Loading branch information
wilkinsona committed Feb 28, 2024
2 parents e6a0202 + 306d52d commit 70769d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
package org.springframework.boot.buildpack.platform.build;

import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -51,11 +52,11 @@ Path asPath() {
try {
URL url = new URL(this.value);
if (url.getProtocol().equals("file")) {
return Paths.get(url.getPath());
return Paths.get(url.toURI());
}
return null;
}
catch (MalformedURLException ex) {
catch (MalformedURLException | URISyntaxException ex) {
// not a URL, fall through to attempting to find a plain file path
}
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -61,9 +61,9 @@ void resolveWhenFilePathReturnsBuildpack() throws Exception {
@Test
void resolveWhenFileUrlReturnsBuildpack() throws Exception {
Path compressedArchive = this.testTarGzip.createArchive();
BuildpackReference reference = BuildpackReference.of("file://" + compressedArchive.toString());
BuildpackReference reference = BuildpackReference.of(compressedArchive.toUri().toString());
Buildpack buildpack = TarGzipBuildpack.resolve(this.resolverContext, reference);
assertThat(buildpack).isNotNull();
assertThat(buildpack).as("Buildpack %s resolved from reference %s", buildpack, reference).isNotNull();
assertThat(buildpack.getCoordinates()).hasToString("example/[email protected]");
this.testTarGzip.assertHasExpectedLayers(buildpack);
}
Expand Down

0 comments on commit 70769d9

Please sign in to comment.