Article NSEG You're Not My MIME Type

You're Not My MIME Type

by
Ellis Morning
from The Daily WTF on (#NSEG)

Andrew performed corporate support for a giant multinational. One day, he was assigned what looked like a straightforward bug: a new Intranet webpage for one business unit was failing to accept CSV spreadsheets containing product information from another business unit.

256px-FortranCodingForm.png

After obtaining the proper permissions, Andrew first attempted to duplicate the issue. He browsed to the Intranet upload page, then tried to upload the user's example CSV files. Each attempt failed with the oh-so-helpful message "Invalid file type."

Well, they were perfectly valid CSV files. Andrew tracked down the developer support contact for the site-Brian-and forwarded him the ticket.

Not an hour later, the ticket boomeranged right back to Andrew, with a note from Brian attached. The code that handles file uploads is a third-party library. You'll have to contact them for help.

Ugh. The very thought set Andrew's teeth on edge. First, he decided to see if there was the slightest chance of resolving the error himself. He googled every search string combination he could think of for the library name, error, scenario-no dice. The company website offered no useful documentation, either. It had support forums, but they were ghost towns.

Andrew's dread amplified. Realistically, this wasn't going to get fully resolved before the heat death of the universe. That whole time, Andrew was sure to have users breathing down his neck. His next effort was to get a workaround in place. After making several phone calls and painfully backtracking his way to the people in charge of the dual business unit venture ("Tiffany? Oh, she doesn't even work here anymore. You want Rob!"), he arranged things so that his users could email their CSV files directly to one person in the other business unit.

These herculean efforts garnered Andrew nothing but huffy scorn. "This is really inconvenient for us," nagged the user who'd logged the ticket.

"It's the best we can do until we get this third-party code fixed," Andrew replied, taking it in stride.

Well, he'd done what he could. It was time to give third-party support a call. After navigating an extensive phone tree, he had a (presumed) live specimen on the other end to whom he could explain the issue.

"So why's this happening?" he asked.

"That doesn't sound familiar," Carl, the rep on the other side, told him. "We'll have to try to duplicate the issue on our end. Do you have some of these files?"

"Yes, I can email them to you," Andrew said.

"Great! We'll test that out and let you know what we find."

To his credit, Carl called back within a few days to notify Andrew that the behavior had been duplicated. However, he didn't know what was going wrong either, and would have to escalate the ticket on his end.

A few weeks later, Andrew received another call from Carl. "All right, this is admittedly a strange case. Let me explain. To determine a valid file type, our code checks and ensures that the MIME type of an uploaded file matches the known MIME types associated with the file extension. It does this by looking at the beginning of the file and following some rules of thumb."

"OK," Andrew said, furiously scribbling all this down in a notebook for future reference.

"It's a safety feature," Carl said. "Looking at your example files, they all begin with entries that start with C, then a space."

"Yeah," Andrew confirmed. "Those are part numbers."

"Well, back in the days of punch cards, FORTRAN programs indicated comment lines by punching a 'C' character in the first column, usually followed by a space."

Andrew froze for a few seconds. "Wait-so your code sees our part numbers and concludes the file is a FORTRAN program?"

"I'm afraid so," Carl said. "It's working as designed."

"Working as designed?! It's not flipping working at all!" Andrew cried.

"This is expected behavior given your input," Carl said. "You can edit your CSV files to not start with C-space values, or modify your logic around our library so that-"

"No, I can't do either of those things!" Andrew cut him off. "The users aren't gonna change their files, and I have no access to the code! Couldn't you edit the library to not make that check, and just be happy with a .csv file extension?"

"We're not prepared to do that at this time, but we can file a feature request." In other words, Sorry, buddy. Your company doesn't spend enough money with our company.

"Fine," Andrew growled, then hung up the phone. He pulled up his original support ticket to add this information and escalate it back to Brian, wondering how many minutes it would take to get kicked back with another blasi(C) retort.

As always, thanks for reading! If you like my articles, you might just love my new sci-fi/fantasy adventure novel about a knight who travels the galaxy with a starship, going on quests and getting into mischief. It has no WTFs in it (intentionally anyway), but hopefully the sword-fighting and deadly court intrigue make up for that. Enjoy! -Ellis

inedo50.png[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too! TheDailyWtf?d=yIl2AUoC8zAkkYow9geZtI
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments