|
|
|
@ -143,24 +143,35 @@ public class FileDownloaderServiceProvider {
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String []urlSegments = url.toString().split("/");
|
|
|
|
|
if (urlSegments.length < 1) {
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Cannot determine the file name for the remote file");
|
|
|
|
|
String fullQualifiedName = null;
|
|
|
|
|
String query = url.getQuery();
|
|
|
|
|
if (query != null && query.startsWith("fileName=")) {
|
|
|
|
|
String[] queryParts = query.split("=", 2);
|
|
|
|
|
if (queryParts.length > 1 && !queryParts[1].isEmpty()) {
|
|
|
|
|
fullQualifiedName = queryParts[1];
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String fullQualifiedName = urlSegments[urlSegments.length - 1];
|
|
|
|
|
String []fileNameSegments = fullQualifiedName.split("\\.(?=[^.]+$)");
|
|
|
|
|
if (fileNameSegments.length != 2) {
|
|
|
|
|
if (fullQualifiedName == null) {
|
|
|
|
|
String[] urlSegments = url.getPath().split("/");
|
|
|
|
|
if (urlSegments.length > 0) {
|
|
|
|
|
fullQualifiedName = urlSegments[urlSegments.length - 1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (fullQualifiedName != null) {
|
|
|
|
|
String[] fileNameSegments = fullQualifiedName.split("\\.(?=[^.]+$)");
|
|
|
|
|
if (fileNameSegments.length == 2) {
|
|
|
|
|
return fileNameSegments;
|
|
|
|
|
} else {
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Error encountered when constructing file name");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Error encountered when constructing file name");
|
|
|
|
|
log.debug("Cannot determine the file name for the remote file");
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return fileNameSegments;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|