Allow also URLs with additional parameters #118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not all URLs end with JAR or ZIP, e.g., if we load content from an HTTPFS Service.
Examples for testing: (a,c,d work as expeced) (b => more logic needed to create a JAR name from this URL)
import java.io.{File, PrintStream}
import java.net.URL
import java.nio.file.{Files, Paths}
def getFileFromLocation(location: String): String = {
val url = new URL(location)
val file = url.getFile.split("/")
if (file.length > 0) {
if ( file.last.contains('?') ) {
file.last.split('?')(0)
}
else {
file.last
}
} else {
""
}
}
val fnA = "http://cdsw-mk4-1.gce.cloudera.com:8888/filebrowser/download=/user/systest/TOOLBOX/SparkShellUtilities.jar?user.name=123"
val a = getFileFromLocation(fnA)
a
val fnB = "https://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi-toolkit&v=0.9.2-SNAPSHOT&c=all"
val b = getFileFromLocation(fnB)
b
val fnC = "http://cdsw-mk4-1.gce.cloudera.com:8888/filebrowser/download=/user/systest/TOOLBOX/SparkShellUtilities.jar"
val c = getFileFromLocation(fnC)
c
val fnD = "http://cdsw-mk4-1.gce.cloudera.com:8888/filebrowser/download=/user/systest/TOOLBOX/SparkShellUtilities.jar?user.name=123&doas=123456"
val d = getFileFromLocation(fnD)
d