Novik / ruTorrent

Yet another web front-end for rTorrent
Other
2.01k stars 407 forks source link

plugin: tracklabels does not honor $topDirectory for unknown torrents #1530

Closed thewisenerd closed 7 years ago

thewisenerd commented 7 years ago

https://github.com/Novik/ruTorrent/blob/master/plugins/tracklabels/action.php#L64

the plugin tracklabels does not currently honor the $topDirectory configuration leading to a bunch of requests that 404. It is currently

header("Location: ".dirname($_SERVER['PHP_SELF']).'/trackers/unknown.png');

whereas it should take into consideration that the $$topDirectory might be different.

(something along the lines of)

header("Location: ".$topDirectory.dirname($_SERVER['PHP_SELF']).'/trackers/unknown.png');
Micdu70 commented 7 years ago

?? "$topDirectory" variable is not, and should not be, used for webserver url...

Why not giving/displaying those "404" you have? (server log/browser inspector)

thewisenerd commented 7 years ago

I think it's caused because I don't really have ruTorrent in my $topDirectory but my server's configured to serve ruTorrent -from- my $topDirectory. So, when dirname($_SERVER['PHP_SELF']) is called, this -expects- to be at the right path, while it really isn't.

example: this is my caddyfile.

:8080/rt/ {
        root /path/to/ruTorrent
        index index.html
        fastcgi / /run/php/php7.0-fpm.sock php
}

the request being made (that 404's);

https://192.168.1.84:8080/plugins/tracklabels/trackers/unknown.png

request header path: path:/plugins/tracklabels/trackers/unknown.png

this would be correct, according to dirname($_SERVER['PHP_SELF']) but given ruTorrent doesn't really exist in my $topDirectory, this errors.

is it necessary that if I do set my $topDirectory, ruTorrent expects itself to actually exist in the server_root/$topDirectory ?

Micdu70 commented 7 years ago

Simply: header("Location: ./trackers/unknown.png");

Does it work for you?

thewisenerd commented 7 years ago

Yes, it does. thanks for #1531, it should fix this. closing issue.