mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-26 05:32:58 +08:00
Polish "Add support for long fine names for tar archives"
See gh-1139
This commit is contained in:
@@ -141,9 +141,9 @@ public abstract class ProjectGenerationController<R extends ProjectRequest> {
|
||||
|
||||
private TarArchiveOutputStream createTarArchiveOutputStream(OutputStream output) {
|
||||
try {
|
||||
final TarArchiveOutputStream taos = new TarArchiveOutputStream(new GzipCompressorOutputStream(output));
|
||||
taos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
|
||||
return taos;
|
||||
TarArchiveOutputStream out = new TarArchiveOutputStream(new GzipCompressorOutputStream(output));
|
||||
out.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
|
||||
return out;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
|
||||
@@ -67,11 +67,13 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
|
||||
@Test
|
||||
void tgzProjectWithLongFilenames() {
|
||||
String queryParams = "name=spring-boot-service&dependencies=org.acme:foo&artifactId=spring-boot-service"
|
||||
+ "&groupId=com.spring.boot.service&baseDir=spring-boot-service";
|
||||
|
||||
ResponseEntity<byte[]> entity = downloadArchive("/starter.tgz?" + queryParams);
|
||||
ResponseEntity<byte[]> entity = downloadArchive(
|
||||
"/starter.tgz?name=spring-boot-service&artifactId=spring-boot-service"
|
||||
+ "&groupId=com.spring.boot.service&baseDir=spring-boot-service");
|
||||
assertArchiveResponseHeaders(entity, MediaType.valueOf("application/x-compress"), "spring-boot-service.tar.gz");
|
||||
ProjectStructure project = tgzProjectAssert(entity.getBody());
|
||||
assertThat(project).containsFiles(
|
||||
"spring-boot-service/src/test/java/com/spring/boot/service/springbootservice/SpringBootServiceApplicationTests.java");
|
||||
}
|
||||
|
||||
private void assertArchiveResponseHeaders(ResponseEntity<byte[]> entity, MediaType contentType, String fileName) {
|
||||
|
||||
Reference in New Issue
Block a user