nelu / rutorrent-thirdparty-plugins

Plugins for ruTorrent web client, filemanager, fileshare, fileupload, mediastream
59 stars 43 forks source link

init.js / checkinputs() bug if $topDirectory isn't set causes some operations (compress, extract) to fail (plus fix) #50

Open zEdS15B3GCwq opened 4 years ago

zEdS15B3GCwq commented 4 years ago

Hi,

I'm aware that this project is not being actively maintained, however, reporting this bug and a fix for it may benefit those who are still using this version of the plugin and are looking for a solution.

The problem is, basically, that some operations (archive extract, compress and maybe others) don't have any effect, even though no error is reported. At the moment I've identified the underlying cause affecting the compress archive operation, and I'm looking into why extraction doesn't work.

I'm not an expert in PHP or JS, by far not, but I think I've been able to put together how this plugin works. It's still possible that I've misunderstood/overlooked some points.

Archiving

Update:

Extraction

This isn't a bug per se, just a problem with permissions. File existence and type related checks in rutorrent's lfp.php (such as is_file, test etc.) use PHP is_file() and similar functions, which don't work properly unless they have read permission on the folder containing the examined file. FileManager uses some of these functions prior to executing operations, e.g. checking for an existence of an archive. This can create problems, however, as FileManager operations run as the rtorrent user (through RPC) and not as the web-server user. If the two users are different, their permissions can also be different, thus some file operations can fail because the file_exist() and is_file() etc. PHP functions fail for the web-server user, even though they would run just fine for the rtorrent user.

Ergo, make sure the web-server user has read permissions on the download folder, or remove the LFS::is_file and similar checks.