6 ms·
Here's another one.. In facebook apps settings, if you enter a url ending with a "/", the error message is "The url can't end with a '/'". Can't help but think
by d0m 14y ago
Here's another one.. In facebook apps settings, if you enter a url ending with a "/", the error message is "The url can't end with a '/'". Can't help but think about that lazy programmer who prefered to shoot an error message rather than fixing it. The irony is that it's often way easier and faster to add a .replace() and fixing it rather than writing , testing and translating the error message.
- TylerE 14y agoThat's not a safe assumption, especially in the presence of a CMS system. foo.com/bar and foo.com/bar/ (-> foo.com/bar/index.html) can be totally seperate URLs.
- Goopplesoft 14y agoYou're missing his point. Its a safe assumption in the case that the latter gives you an error pointing you to the former. If the latter was a blank/meaningful response that would make sense, but its not.
- nolok 14y agoYou misunderstood OP, the FB error he describe is not about hitting a url "path/" that 301 to "path" and FB not detecting it. In the uri standards, /path and /path/ are just as different as /path and /path2.
- slewis 14y agohttp://example.com/page http://example.com/page and http://example.com/page/ http://example.com/page/ could be totally different pages... So .replace()'ing could silently cause unexpected breakage.
- nailer 14y agoThey shouldn't be. Slash normalization is pretty normal and it's ones of the first things frameworks add.
- jarin 14y agoHowever, they're probably building to the URL spec which is what they should be doing.
- eob 14y agoIt doesn't matter if some people do slash normalizing. It's not how the web works at the standards-level.
- artursapek 14y agoWell, maybe everyone's unawareness of this means the standard is wrong.
- silentOpen 14y agoNo.
- itsnotlupus 14y agoA de facto standard? We'll have to ask the committee about that.
- petsos 14y agoThey are not allowing the trailing / anyway, so what's the difference?
- nolok 14y agoIf you type google.com you don't expect FB to replace it to bing.com without telling you. /path and /path/ are two totally different things in the standards, just like /path and /path2. Sure in most cases with and without trailing slash gives the same page; but it's not something you can assume. Same reason why "we don't allow https links" doesn't mean you can just drop the s.
- mmatants 14y agoYou are describing a developer-oriented UI. Silently doing an automagic .replace() on developer-entered information may cause more infuriation and (importantly) bugs than flagging it as invalid. Devs should not be left blissfully unaware of string format restrictions.