Uri encoding for local filenames. (#710)

* Uri encoding for local filenames. Kodi should now be able to play http-served files with spaces or other special characters in their name.

* Uri encoding for local files served with "share with Kore".
This commit is contained in:
Michael Bien 2020-02-20 20:54:35 +01:00 committed by GitHub
parent e63fd40d9f
commit 571e3ceae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -160,11 +160,11 @@ public class HttpApp extends NanoHTTPD {
}
String path = null;
if (currentIsFile) {
path = localFileLocationList.get(currentIndex).fileName + "?number=" + currentIndex;
String filename = localFileLocationList.get(currentIndex).fileName;
path = Uri.encode(filename) + "?number=" + currentIndex;
} else {
Uri uri = localUriList.get(currentIndex);
String filename = getFileNameFromUri(uri);
path = filename + "?uri=" + currentIndex;
String filename = getFileNameFromUri(localUriList.get(currentIndex));
path = Uri.encode(filename) + "?uri=" + currentIndex;
}
return "http://" + ip + ":" + getListeningPort() + "/" + path + "&token=" + token;
}