mirror of https://github.com/apache/archiva.git
Remove %20 in directories name when they contain spaces
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@511870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
401840ce73
commit
31bc77d503
|
@ -19,6 +19,7 @@ package org.apache.maven.archiva.converter.legacy;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.converter.ConversionListener;
|
||||
import org.apache.maven.archiva.converter.RepositoryConversionException;
|
||||
import org.apache.maven.archiva.discoverer.Discoverer;
|
||||
|
@ -76,11 +77,25 @@ public class DefaultLegacyRepositoryConverter
|
|||
|
||||
try
|
||||
{
|
||||
legacyRepository = artifactRepositoryFactory.createArtifactRepository( "legacy", legacyRepositoryDirectory
|
||||
.toURI().toURL().toString(), legacyLayout, null, null );
|
||||
String legacyRepositoryDir = legacyRepositoryDirectory.toURI().toURL().toString();
|
||||
String repositoryDir = repositoryDirectory.toURI().toURL().toString();
|
||||
|
||||
repository = artifactRepositoryFactory.createArtifactRepository( "default", repositoryDirectory.toURI()
|
||||
.toURL().toString(), defaultLayout, null, null );
|
||||
//workaround for spaces non converted by PathUtils in wagon
|
||||
//TODO: remove it when PathUtils will be fixed
|
||||
if ( legacyRepositoryDir.indexOf( "%20" ) >= 0 )
|
||||
{
|
||||
legacyRepositoryDir = StringUtils.replace( legacyRepositoryDir, "%20", " " );
|
||||
}
|
||||
if ( repositoryDir.indexOf( "%20" ) >= 0 )
|
||||
{
|
||||
repositoryDir = StringUtils.replace( repositoryDir, "%20", " " );
|
||||
}
|
||||
|
||||
legacyRepository = artifactRepositoryFactory.createArtifactRepository( "legacy", legacyRepositoryDir,
|
||||
legacyLayout, null, null );
|
||||
|
||||
repository = artifactRepositoryFactory.createArtifactRepository( "default", repositoryDir, defaultLayout,
|
||||
null, null );
|
||||
}
|
||||
catch ( MalformedURLException e )
|
||||
{
|
||||
|
@ -97,8 +112,8 @@ public class DefaultLegacyRepositoryConverter
|
|||
}
|
||||
catch ( DiscovererException e )
|
||||
{
|
||||
throw new RepositoryConversionException( "Unable to convert repository due to discoverer error:"
|
||||
+ e.getMessage(), e );
|
||||
throw new RepositoryConversionException(
|
||||
"Unable to convert repository due to discoverer error:" + e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,18 +53,7 @@ public class DefaultConfiguredRepositoryFactory
|
|||
|
||||
public ArtifactRepository createRepository( RepositoryConfiguration configuration )
|
||||
{
|
||||
File repositoryDirectory = new File( configuration.getDirectory() );
|
||||
String repoDir = repositoryDirectory.toURI().toString();
|
||||
|
||||
//workaround for spaces non converted by PathUtils in wagon
|
||||
//todo: remove it when PathUtils will be fixed
|
||||
if ( repoDir.indexOf( "%20" ) >= 0 )
|
||||
{
|
||||
repoDir = StringUtils.replace( repoDir, "%20", " " );
|
||||
}
|
||||
|
||||
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) repositoryLayouts.get( configuration.getLayout() );
|
||||
return repoFactory.createArtifactRepository( configuration.getId(), repoDir, layout, null, null );
|
||||
return createRepository( configuration.getLayout(), configuration.getId(), configuration.getDirectory());
|
||||
}
|
||||
|
||||
public ProxiedArtifactRepository createProxiedRepository( ProxiedRepositoryConfiguration configuration )
|
||||
|
@ -126,10 +115,24 @@ public class DefaultConfiguredRepositoryFactory
|
|||
|
||||
public ArtifactRepository createLocalRepository( Configuration configuration )
|
||||
{
|
||||
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) repositoryLayouts.get( "default" );
|
||||
File localRepository = new File( configuration.getLocalRepository() );
|
||||
localRepository.mkdirs();
|
||||
return repoFactory.createArtifactRepository( "local", localRepository.toURI().toString(), layout, null, null );
|
||||
return createRepository( "default", "local", configuration.getLocalRepository() );
|
||||
}
|
||||
|
||||
public ArtifactRepository createRepository( String layout, String id, String directory )
|
||||
{
|
||||
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) repositoryLayouts.get( layout );
|
||||
File repository = new File( directory );
|
||||
repository.mkdirs();
|
||||
|
||||
String repoDir = repository.toURI().toString();
|
||||
//workaround for spaces non converted by PathUtils in wagon
|
||||
//TODO: remove it when PathUtils will be fixed
|
||||
if ( repoDir.indexOf( "%20" ) >= 0 )
|
||||
{
|
||||
repoDir = StringUtils.replace( repoDir, "%20", " " );
|
||||
}
|
||||
|
||||
return repoFactory.createArtifactRepository( id, repoDir, repositoryLayout, null, null );
|
||||
}
|
||||
|
||||
private static String getUpdatePolicy( String policy, int interval )
|
||||
|
|
Loading…
Reference in New Issue