Menu

#62 Commandline FTP uri not properly parsed

open
nobody
None
5
2014-12-30
2010-06-10
Anonymous
No

Just tried to set up projectx to process some recordings via cli, but that failed. After investigation i've found the following bugs:

net.sourceforge.dvb.projectx.common.Common#getInputFile(String) fails to match files with '#' and possibly other special characters to the correct ftp file
Reason:
URL is used to extract the path part. As the cli-argument is passed unchanged, special characters like '#' must be encoded already in the cli-argument or that part will be assigned to the 'ref' of the url. Nothing too wrong so far. The problem is, the uri returned by XInputFileImpl#toString() does not escape the '#' character. so the filename will be truncated to the part before that. If the cli-argument was not escaped as well, a file can be matched as both get truncated. But this only chooses the first occurence of the truncated filename. So instead of the requested "file#2.ts" it will coose "file#1.ts"
Solution:
I'm not totally sure what would be the right way to fix this. As a quick-fix for myself i changed the cli-argument parser to URI as this can decode any encoded parts. And to extract the filename of the ftp-file for comparison, i just that the substring starting from the third slash. Maybe a cleaner solution would be to also encode special chars in the URI returned by XInputFileImpl#toString() and also use url to extract the filename.

net.sourceforge.dvb.projectx.xinput.ftp.XInputDirectoyImpl#XInputDirectoyImpl(URL) fails to parse the user:pass@host part if user starts with the same characters as host.
Reason: the legacy method used to retrieve the user and pass tests if the uri starts host after the 'ftp://' part
Solution: use the new methods that return UserInfo / Host properly, or parse them properly (iirc just that is done a few lines above in the String constructor)

Discussion


Log in to post a comment.

MongoDB Logo MongoDB