Advertisement:

Author Topic: all attachments are corrupted  (Read 1804 times)

Offline krick

  • Jr. Member
  • **
  • Posts: 173
    • tank + paladin = tankadin
all attachments are corrupted
« on: January 30, 2010, 11:42:54 AM »
I've been having some problems with my SMF 1.1.11 forum lately and I think I've managed to get it all working again except that all my attachments seem to be corrupted (12 attachments/10 thumbnails).

Any ideas what might have happened or how to fix it?


Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,668
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: all attachments are corrupted
« Reply #1 on: January 30, 2010, 11:44:03 AM »
How are they corrupted what happens when you download them?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline krick

  • Jr. Member
  • **
  • Posts: 173
    • tank + paladin = tankadin
Re: all attachments are corrupted
« Reply #2 on: January 30, 2010, 12:03:32 PM »
Actually, I think I might have figured out what happened.

I had to restore my site from a backup and I think my FTP program transferred the files in the attachments directory as ASCII instead of BINARY.

I used BeyondCompare to do a HEX diff between a known good file and its corrupted counterpart and I see the telltale signs.  Every hex 0D in the file has a 0A inserted before it in the corrupted version.

/facepalm

I managed to recover some of the files from another backup that wasn't corrupted, but I'm still showing...

"15 attachments/avatars are being reported as the wrong filesize"

:(

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,668
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: all attachments are corrupted
« Reply #3 on: January 30, 2010, 12:14:28 PM »
FTP will get you sometimes. I wonder why they even bother having two formats just be binary by default
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline krick

  • Jr. Member
  • **
  • Posts: 173
    • tank + paladin = tankadin
Re: all attachments are corrupted
« Reply #4 on: January 30, 2010, 12:38:27 PM »
Amen to that.  BINARY should be the out-of-the-box default.
I've managed to recover most of the files from other backups.


MrPhil

  • Guest
Re: all attachments are corrupted
« Reply #5 on: January 30, 2010, 01:05:34 PM »
FTP will get you sometimes. I wonder why they even bother having two formats just be binary by default

Why? Because TEXT files use different formats to mark the end of each line on DOS/Windows (carriage-return/linefeed x0D0A), Mac (carriage-return x0D), and Linux (newline x0A). Whenever you transfer a text (human readable) file from one type of system to another, you have to translate the end-of-line marker to the receiving system's convention. Unfortunately, left to guess which mode to use (text/ASCII or binary) by examining the file contents, an FTP client isn't going to have a perfect record of selecting the right mode.

Offline krick

  • Jr. Member
  • **
  • Posts: 173
    • tank + paladin = tankadin
Re: all attachments are corrupted
« Reply #6 on: January 30, 2010, 03:47:59 PM »
Why? Because TEXT files use different formats to mark the end of each line on DOS/Windows (carriage-return/linefeed x0D0A), Mac (carriage-return x0D), and Linux (newline x0A). Whenever you transfer a text (human readable) file from one type of system to another, you have to translate the end-of-line marker to the receiving system's convention. Unfortunately, left to guess which mode to use (text/ASCII or binary) by examining the file contents, an FTP client isn't going to have a perfect record of selecting the right mode.

Most modern text editors and software development environments know about the different line endings and handle them all with zero problems.  It's just people who insist on using Windows Notepad that are having problems.