postrank-labs / postrank-uri

URI normalization, c14n, escaping, and extraction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

removing trailing slash breaks url

mmb opened this issue · comments

irb(main):002:0> PostRank::URI.clean('http://www.gliffy.com/publish/2886461/')
=> "http://www.gliffy.com/publish/2886461"

http://www.gliffy.com/publish/2886461/ works fine
http://www.gliffy.com/publish/2886461 returns 404

Granted that they should fix their site but what is postrank-uri's stance on this?

This is "intentional" on our part. We recognize that removing the trailing slash may break some sites (in our own research, its in <5%), but we need to be aggressive to generate clean ID's. As such, our rule currently is to always remove the slash. So, the behavior is as designed.

If you're using the gem and need / want to disable the trailing slash logic, in theory that could be exposed via some optional configuration parameters.

I have a need for it and I am currently redefining PostRank::URI.normalize.

I'll send a pull request for an option if you want but I understand if you want to keep the code focused on your normal use cases.