Merge remote-tracking branch 'origin/patch'

This commit is contained in:
ghidra1 2021-06-25 14:42:47 -04:00
commit c96244af02
8 changed files with 160 additions and 123 deletions

View file

@ -15,11 +15,9 @@
*/
package ghidra;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.*;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import generic.jar.ResourceFile;
@ -93,6 +91,17 @@ public class GhidraJarApplicationLayout extends GhidraApplicationLayout {
* @return A {@link ResourceFile} from the given {@link URL}
*/
private ResourceFile fromUrl(URL url) {
return new ResourceFile(URLDecoder.decode(url.toExternalForm(), StandardCharsets.UTF_8));
String urlString = url.toExternalForm();
try {
// Decode the URL to replace things like %20 with real spaces.
// Note: can't use URLDecoder.decode(String, Charset) because Utility must be
// Java 1.8 compatible.
urlString = URLDecoder.decode(urlString, "UTF-8");
}
catch (UnsupportedEncodingException e) {
// Shouldn't happen, but failed to find UTF-8 encoding.
// Proceed without decoding, and hope for the best.
}
return new ResourceFile(urlString);
}
}