Merge pull request #933 from htztomic

* pr/933:
  Ensure executable bit is set on wrapper when baseDir has space

Closes gh-933
This commit is contained in:
Madhura Bhave 2019-07-03 17:18:58 -07:00
commit 9df2d29462
2 changed files with 41 additions and 4 deletions

View File

@ -230,13 +230,13 @@ public class MainController extends AbstractInitializrController {
ZipFileSet set = new ZipFileSet();
set.setDir(dir);
set.setFileMode("755");
set.setIncludes(wrapperScript);
set.createInclude().setName(wrapperScript);
set.setDefaultexcludes(false);
zip.addFileset(set);
set = new ZipFileSet();
set.setDir(dir);
set.setIncludes("**,");
set.setExcludes(wrapperScript);
set.createExclude().setName(wrapperScript);
set.setDefaultexcludes(false);
zip.addFileset(set);
zip.setDestFile(download.getCanonicalFile());
@ -257,12 +257,12 @@ public class MainController extends AbstractInitializrController {
TarFileSet set = zip.createTarFileSet();
set.setDir(dir);
set.setFileMode("755");
set.setIncludes(wrapperScript);
set.createInclude().setName(wrapperScript);
set.setDefaultexcludes(false);
set = zip.createTarFileSet();
set.setDir(dir);
set.setIncludes("**,");
set.setExcludes(wrapperScript);
set.createExclude().setName(wrapperScript);
set.setDefaultexcludes(false);
zip.setDestFile(download.getCanonicalFile());
Tar.TarCompressionMethod method = new Tar.TarCompressionMethod();

View File

@ -0,0 +1,37 @@
/*
* Copyright 2012-2019 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring.initializr.web.project;
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
import org.junit.jupiter.api.Test;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
/**
* @author HaiTao Zhang
*/
@ActiveProfiles("test-default")
public class MainControllerArchiveIntegrationTests extends AbstractFullStackInitializrIntegrationTests {
@Test
void baseDirectorySeparatedBySpace() {
ResponseEntity<byte[]> entity = downloadArchive("/starter.zip?artifactId=demo&baseDir=demo trial");
zipProjectAssert(entity.getBody()).hasBaseDir("demo trial").hasExecutableFile("mvnw").isJavaProject();
}
}