Browse Source

Fix AndFTP files download

pull/474/head
Micdu70 6 years ago
parent
commit
f74e066521
  1. 10
      app/src/main/java/org/transdroid/core/gui/DetailsFragment.java

10
app/src/main/java/org/transdroid/core/gui/DetailsFragment.java

@ -550,6 +550,14 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -550,6 +550,14 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
if (urlBase == null || urlBase.equals("")) {
urlBase = "ftp://" + currentServerSettings.getAddress() + "/";
}
String rootDir = "";
if (urlBase.matches("(ftps?|scp|sftp)://.+/.+")) {
String[] split = urlBase.split("/", 4);
rootDir = "/" + split[3];
if (!rootDir.endsWith("/")) {
rootDir = rootDir + "/";
}
}
// Try using AndFTP intents
Intent andftpStart = new Intent(Intent.ACTION_PICK);
@ -578,7 +586,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -578,7 +586,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
if (file.startsWith("/") && file.indexOf("/", 1) < 0) {
file = file.substring(1);
}
andftpStart.putExtra("remote_file" + (f + 1), file);
andftpStart.putExtra("remote_file" + (f + 1), rootDir + file);
}
}
if (andftpStart.resolveActivity(getActivity().getPackageManager()) != null) {

Loading…
Cancel
Save