pull/587/head
FongMi 1 year ago
parent a4399a8492
commit b4936afd9d
  1. 2
      app/src/main/java/com/fongmi/android/tv/server/process/Local.java
  2. 6
      catvod/src/main/java/com/github/catvod/utils/Path.java

@ -45,7 +45,7 @@ public class Local implements Process {
private Response getFile(Map<String, String> headers, String path) {
try {
File file = Path.root(path.substring(5));
File file = Path.local(path.substring(5));
if (file.isDirectory()) return getFolder(file);
if (file.isFile()) return getFile(headers, file, NanoHTTPD.getMimeTypeForFile(path));
throw new FileNotFoundException();

@ -121,9 +121,9 @@ public class Path {
}
public static File local(String path) {
File file1 = new File(path.replace("file:/", ""));
File file2 = new File(path.replace("file:/", rootPath()));
return file2.exists() ? file2 : file1.exists() ? file1 : new File(path);
path = path.replace("file:/", "");
File file = new File(root(), path);
return file.exists() ? file : new File(path);
}
public static String read(File file) {

Loading…
Cancel
Save