Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly Decode URL #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/gab/opencv/OpenCV.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.nio.charset.StandardCharsets;
import java.io.File;
import java.lang.reflect.Field;
import java.net.URL;
Expand Down Expand Up @@ -367,9 +368,14 @@ private void setupWorkingImages(){
private String getLibPath() {
URL url = this.getClass().getResource("OpenCV.class");
if (url != null) {
// Convert URL to string, taking care of spaces represented by the "%20"
// string.
String path = url.toString().replace("%20", " ");
String path = "";
try{
path = java.net.URLDecoder.decode(url.toString(), StandardCharsets.UTF_8.name());
}
catch(Exception e){
//not going to happen - value came from JDK's own StandardCharsets
e.printStackTrace();
}
int n0 = path.indexOf('/');

int n1 = -1;
Expand Down