- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
It does...
Admin
It does...
Admin
GetAllFileExtensionsPossible() { //return array of file extensions }
Admin
Exactly what I was thinking after I got done reading this.
Fire them all!! :P jk.
Admin
I should have also stated, why is everyone so gung ho about "people getting fired", "getting people fired", or "I can't believe that dumbass is still holding on to his job" attitude, especially these days? I think OP of this comment was on to something by finding fault with the very dev who couldn't believe the guy was still working at the companty.
Learn to deal with the blows. In corporate world, I'm more worried about whether I'll be given an unrealistic deadline for a crucial project, or if I'll be given the time to properly resolve a problem instead of issuing bandaids, or if after all my work, the project gets cut. Sure, we all have our fair share of B.S. to deal with... and we all produce some of our own. It's a natural function of the human body.
Admin
Stupefied, mortified, petrified... by you.
So why didn't you (the poster) ask him why he didn't just check if it was .txt ? It's not like he's ever going to learn if he doesn't get asked those kinds of questions...
Admin
Neither the business process nor the software have any business specifying the file extension. The process should specify the steps to follow to create the data, and the software should validate the data. And then everything will keep working even if Excel 2010 suddenly decides to use a different default extension for tab-separated exports.
Admin
not a very good check anyway...you can rename any file to .txt
Admin
The fact that the 'three letters at the end of a filename' don't guarantee anything at all about its contents anyway seems to have completely flown over this poster's head.
It might make more sense to use 'file' on the file, to verify that it really is text. Checking the last three letters of the filename is irrelevant.
Admin
On the Internet 'extensions' are irrelevant, because real software uses MIME-Type (originally intended for use with email, since expanded to lots of other things, including HTTP)
Notable exceptions include most crap distributed by Microsoft.
Admin
Such as IE ignoring a misconfigured web server and rendering anything that looks like HTML as HTML. Source of no end of problems.
Admin
Also, just how do you think a web servers normally determine the mime type of most random files linked to in a web page?
Admin
The real WTF here is that someone believes that a file extension has anything to do with the contents. Who cares whether the filename ends in ".txt" or not?
Admin
They actually "fixed" that in one of the IE7 beta builds. Result: the 90% of servers misconfigured to hand out buggered up MIME types resulted in a very broken web browsing experience. And, in case you were wondering, those web servers were almost universally Apache.
Admin
I think a large number of WTFs are executed by simply not using the python(or any other batteries-included language) module built to achieve the task at hand in 10 lines of code or so.
Admin
Definitely the wrong approach - he should have provided him with a dozen new extensions every day to add to the list.....
Admin
On balance, I like the original code better. The original code will reject filenames that are almost certain to be invalid. The suggested code will reject any number of perfectly valid files.
On Windows at least, it does make some sense to validate extensions. Windows will treat a file very differently based on its extension even in system-like contexts. (UNIXes may if you double-click on it from a GUI, but in system-like contexts, they ignore the extension.)
This Windows/UNIX difference is a source of much irritation to people who deal with cross-platform software.
Admin
Your MP3 player just called. It wants it's files back!
Admin
validating the file type by the extension is the real wtf here
Admin
The frist intelligent comment in the thread.
Admin
Admin
Admin
Fcking lol!
Admin
i haven't read all the comments, but i hope someone else has noticed that .asp, .php, .ascx, .csproj, .vbproj etc etc are all text files!