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

Form FTP download URI properly #176

Closed
wants to merge 4 commits into from

Conversation

Projects
None yet
3 participants
@Uranium235
Copy link

commented Nov 2, 2014

Only send the scheme and host in the intent data Uri and construct an absolute path for every file.
Hopefully that fixes all "file not found" and "cannot change directory" issues with AndFTP.
I have not tested the changes as I currently lack an Android development environment.
Instead of urlBase = urlBase + "/" it should be urlBase += "/"

Form FTP download URI properly
Only send the scheme and host in the intent data Uri and construct an absolute path for every file.
Hopefully that fixes all "file not found" and "cannot change directory" issues with AndFTP.
@Uranium235

This comment has been minimized.

Copy link
Author

commented Nov 5, 2014

Maybe I should also elaborate a little on the problem:
My rtorrent download directory is located in /var/p2p/download/.
My FTP server is chrooted to /var/p2p/. I cannot set the FTP root to the download directly because the chrooted folder needs to be read only (vsftpd).
So I figured my base URL should be set to ftp://mydomain.com/download/.
But whatever I set as the base URL, I cannot download anything and always get the error message "file not found" for single file torrents or "cannot change directory" for files inside subfolders.
I even tried mimicking (via mount) an absolute path on the server where /var/p2p/download/ would be valid since that's what the error message led me to believe when AndFTP was missing, that always the absolute server path is passed along. After looking at the code here, that is not the case though.
Since I couldn't really verify to what getRelativePath is relative to, I am taking an educated guess it is the configured rtorrent download location.
I am hoping that this patch resolves my issues. In any case, this patch is much more clear as to what is going on and what is being sent and what should be set as base URL as well as handling the whole trailing slash entered or not issue.
tbh, I am not 100% sure that Uri.getPath() returns the trailing slash made sure to be present before parsing.
Sorry that I cannot test the changes myself atm...

Uranium235 added some commits Nov 18, 2014

Reuse already parsed URL
Reuse the already parsed URL for Username.
Make sure url for VIEW intents with ftp scheme are constructed the same way as for AndFTP.
@Uranium235

This comment has been minimized.

Copy link
Author

commented Nov 18, 2014

Fixed some minor issues.
(sorry that the commits are messy - using online editor)

@Uranium235

This comment has been minimized.

Copy link
Author

commented Nov 19, 2014

Tinkering about the problem, it may be that this solution is a problem where the FTP server automatically starts in a sub directory (and the parent folders are not accessible).
Maybe it should be the other way around and a leading slash be passed with the file name to truly construct an absolute url.
If the work around for AndFTP with files in the "root" folder (remove slash when not more than 1 slash) is still needed then, that should be reported as a bug with AndFTP which shouldn't be hard to fix.

@moose392

This comment has been minimized.

Copy link

commented May 7, 2015

Yes I am aware that it wont work without an FTP app, thats not the issue at hand
I have the same problem. As you can see in my screenshot, the sdb/0000/downloads/ part is generated automatically by Transdroid using info from my rutorrent seedbox, but /downloads is the root directory when I view my files via ftp. Thus, I get the "Cannot change directory" error. The path it should use to connect is ftps://username@subdomain.dediseedbox.com/TV/filename

By the way, the base ftps url I am using in the app is ftps://username@subdomain.dediseedbox.com. This is not the source of the problem.

screenshot_2015-05-07-12-23-39_edit

@erickok

This comment has been minimized.

Copy link
Owner

commented Nov 14, 2017

Closing this as I solved it in 9813b96

@erickok erickok closed this Nov 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.