in src/main/java/org/apache/sling/feature/scanner/impl/ContentPackageScanner.java [89:148]
FileType detectContentFileType(final String contentPath) {
FileType fileType = null;
// check for install folders in libs or apps
if (contentPath.startsWith("/libs/") || contentPath.startsWith("/apps/")) {
// check if this is an install folder (I)
// install folders are either named:
// "install" or
// "install.{runmode}"
boolean isInstall = contentPath.indexOf("/install/") != -1;
if (!isInstall) {
final int pos = contentPath.indexOf("/install.");
if (pos != -1) {
final int endSlashPos = contentPath.indexOf('/', pos + 1);
if (endSlashPos != -1) {
isInstall = true;
}
}
}
if (!isInstall) {
// check if this is an install folder (II)
// config folders are either named:
// "config" or
// "config.{runmode}"
isInstall = contentPath.indexOf("/config/") != -1;
if (!isInstall) {
final int pos = contentPath.indexOf("/config.");
if (pos != -1) {
final int endSlashPos = contentPath.indexOf('/', pos + 1);
if (endSlashPos != -1) {
isInstall = true;
}
}
}
}
if (isInstall) {
if (contentPath.endsWith(".jar")) {
fileType = FileType.BUNDLE;
} else if (contentPath.endsWith(".zip")) {
fileType = FileType.PACKAGE;
} else {
for(final String ext : CFG_EXTENSIONS) {
if ( contentPath.endsWith(ext) ) {
fileType = FileType.CONFIG;
break;
}
}
}
}
} else if ( contentPath.startsWith("/etc/packages/") && contentPath.endsWith(".zip")) {
// embedded content package
fileType = FileType.PACKAGE;
}
return fileType;
}