oscarotero / psr7-middlewares

[DEPRECATED] Collection of PSR-7 middlewares
MIT License
668 stars 56 forks source link

BlockSpam default path to spammers.txt is wrong #77

Closed VincentSurelle closed 6 years ago

VincentSurelle commented 7 years ago

The BlockSpam middleware is looking for a wrong path a default

Actually looking for :

__DIR__.'/../../../../vendor/piwik/referrer-spam-blacklist/spammers.txt'
mean
/Users/vincent/Work/hello-world/vendor/oscarotero/psr7-middlewares/src/Middleware/../../../../vendor/piwik/referrer-spam-blacklist/spammers.txt

Real path is :

__DIR__.'/../../../../piwik/referrer-spam-blacklist/spammers.txt'
mean
/Users/vincent/Work/hello-world/vendor/oscarotero/psr7-middlewares/src/Middleware/../../../../piwik/referrer-spam-blacklist/spammers.txt
oscarotero commented 7 years ago

Yes, it depends how was installed psr-7-middlewares (as a root package or as a dependency). You can use composer-locator to locate the real path of spammers.txt

But is also a good idea to check both possible paths (as root or as dependency) to cover the two most common scenarios. Do you want to work in a pull request?