Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: FragaCampos on February 12, 2013, 01:39:27 AM

Title: 404 - Attachment Not Found
Post by: FragaCampos on February 12, 2013, 01:39:27 AM
Hi there.

I've found several people with the same problem after upgrading from SFM 1.x to SMF 2.x but I haven't found a satisfactory answer to this "serious" problem.
I have 7000 attachments and when I upgraded, in localhost and on live forum, almost 3 thousand disapppeared.
I don't have a clue why, but al atttachments were working and they are still in my attachments directory.
The attachments' table in the database is also intact.

Any lights on this?
Thanks.
Title: Re: 404 - Attachment Not Found
Post by: kat on February 12, 2013, 11:17:43 AM
Got a link to a post where this is happening, so we can have a look at it? (Remember it'll need to be open for guest viewing)
Title: Re: 404 - Attachment Not Found
Post by: FragaCampos on February 12, 2013, 11:18:50 AM
I'm analysing my old vs new database (attachment table) and I see something weird. All the old attachments don't have a file_hash, while the attachments that are ok do have a file_hash.
But I wonder why this was not an issue in SMF 1.1.18...

Any clue about this?
I really didn't want to upload 3000 attachments again :(
Title: Re: 404 - Attachment Not Found
Post by: FragaCampos on February 12, 2013, 11:19:34 AM
My forum is in maintenance mode, but i can explain exactly what you want to see if you wish.

Quote from: K@ on February 12, 2013, 11:17:43 AM
Got a link to a post where this is happening, so we can have a look at it? (Remember it'll need to be open for guest viewing)
Title: Re: 404 - Attachment Not Found
Post by: FragaCampos on February 12, 2013, 11:36:19 AM
I detected a difference between the old and new attachments. Clearly a codification problem  :-\



old hash ->

6553_Oea_Coaao_Eiaeai_Oaeiwau_199u_EIC_oao77ab11ea32cba108db8292a2a13f5a2b
6552_Oea_Coaao_Ciiaai_Waoieic_Oweiaia_2007_AODH_oaoc8aa15609d48e322240eeac091c31c56
6551_Oea_Coaao_Aoaadha_Oea_AEieceo_oi_AEoaaaii_2001_EIC_oaob48deeac0802547da7369a99a9d71307


new hash ->
6554_1bf7f29acc47fccdd9311d5d2b27577b7706a718
6555_029e9bbe42fdba0bd7e9684aa510df6b02bf3c07
6556_ff01e92a67b8b877fa3ac592822e2b9fd83e5b5e
Title: Re: 404 - Attachment Not Found
Post by: Arantor on February 12, 2013, 11:43:06 AM
Did you change from ISO to UTF-8 at any point?
Title: Re: 404 - Attachment Not Found
Post by: kat on February 12, 2013, 11:47:37 AM
That's a thought, innit?

I wondered if PrettyURLs might be involved, somewhere, too.

All I was going to try, to start with, was the ol' "Inspect element" thing.

Check a URL or two, that kinda thing.

Generally, a 404 means that the page simply doesn't exist.

A small hunchette... The attachments directory and the actual files, themselves... Are they all read-enabled?

Could it be a CHOWN permissions thing?
Title: Re: 404 - Attachment Not Found
Post by: FragaCampos on February 12, 2013, 12:18:17 PM
Yes, when I upgraded I used "Convert HTML-entities to UTF-8 characters" in the admin panel. Could it be because of that?

Quote from: Arantor on February 12, 2013, 11:43:06 AM
Did you change from ISO to UTF-8 at any point?



My attachments directory is 0755 and all the files inside are 0644.
I don't have prettyurls or SimpleSEF installed...

Quote from: K@ on February 12, 2013, 11:47:37 AM
That's a thought, innit?

I wondered if PrettyURLs might be involved, somewhere, too.

All I was going to try, to start with, was the ol' "Inspect element" thing.

Check a URL or two, that kinda thing.

Generally, a 404 means that the page simply doesn't exist.

A small hunchette... The attachments directory and the actual files, themselves... Are they all read-enabled?

Could it be a CHOWN permissions thing?
Title: Re: 404 - Attachment Not Found
Post by: kat on February 12, 2013, 01:44:17 PM
What you've quoted is CHMOD, not CHOWN.

Your host will have to confirm that you have full CHOWN ownership of everything.
Title: Re: 404 - Attachment Not Found
Post by: FragaCampos on February 12, 2013, 01:55:59 PM
Well, but there's no reason for being a problem with CHOWN, since I did the upgrade in the same server, and the attachments folder didn't change, because I didn't touch it. That folder was doing just fine UNTIL I did the upgrade.
Title: Re: 404 - Attachment Not Found
Post by: kat on February 12, 2013, 02:01:34 PM
/me wanders-off, scratching his head, to try and figure this out...0
Title: Re: 404 - Attachment Not Found
Post by: FragaCampos on February 12, 2013, 02:44:10 PM
Ok, I've installed the forum in my pc like it was before the upgrade, and all attachments are correct and working fine.
I'm going to upgrade on localhost and see if I get the same results, this time without activating the "Convert HTML-entities to UTF-8 characters" afterwords.
Title: Re: 404 - Attachment Not Found
Post by: Arantor on February 12, 2013, 02:48:53 PM
And don't use FileZilla to transfer attachments ;)
Title: Re: 404 - Attachment Not Found
Post by: FragaCampos on February 12, 2013, 04:44:11 PM
Ok, tested and proved.

After the upgrade I went directly to the attachments zone, and the problem is there.
Like I said here (http://www.simplemachines.org/community/index.php?topic=497289.msg3489270#msg3489270), old attachments don't work. :(

PS: I use Total Commander, although I think that's not the problem...
Title: Re: 404 - Attachment Not Found
Post by: kat on February 13, 2013, 05:12:03 AM
I use that, too. It's perfectly OK, for this kinda stuff.

This sure is an odd one.
Title: Re: 404 - Attachment Not Found
Post by: ziycon on April 19, 2013, 05:56:10 PM
I've just come across this issue on one of my live forums using 2.0.1, going to digg deeper and see what I can come up with.
Title: Re: 404 - Attachment Not Found
Post by: ziycon on April 19, 2013, 06:18:22 PM
I've had a look into this more. All the files in the attachment directory are named 'ID_Hash' and the references in the attachment table match the Id and the file hash. Can't seem to see why it's not working all of a sudden. :S
Title: Re: 404 - Attachment Not Found
Post by: FragaCampos on April 22, 2013, 04:19:59 PM
Well, my job is not finished yet... I'm still uploading like 20 attachments per day to correct this. :(
Title: Re: 404 - Attachment Not Found
Post by: kat on April 25, 2013, 06:27:29 AM
Had any luck, so far?
Title: Re: 404 - Attachment Not Found
Post by: ziycon on April 25, 2013, 06:32:47 AM
I've come up with nothing, some attachments work but most don't, can't see anything causing it or anything common between failing attachments.
Title: Re: 404 - Attachment Not Found
Post by: kat on April 25, 2013, 06:42:02 AM
This sure is weird, innit?

If it was Filezilla's "Transfer type" feature, I could understand it. But, we've been through that, haven't we?

One thing I remember, from AGES back, is that Total Commander went through a phase of subtly renaming things, when I uploaded them, by changing the case of the filename. I managed to figure-out why. But, it's so long ago that I can't remember what I did, to correct that.

It's not that, is it?
Title: Re: 404 - Attachment Not Found
Post by: ziycon on April 25, 2013, 08:47:19 AM
I haven't used an ftp application at all, these are files that were attached through SMF and left in the attachments directory.
Title: Re: 404 - Attachment Not Found
Post by: kat on April 25, 2013, 11:37:09 AM
Ah, right. So, just doing the upgrade toasted them?

Now that IS weird.

Any connection with the attachment filetypes?

Were they all jpg, or something else, perhaps?
Title: Re: 404 - Attachment Not Found
Post by: ziycon on April 25, 2013, 05:40:32 PM
All different file types, no similarities across them all.
Title: Re: 404 - Attachment Not Found
Post by: kat on April 26, 2013, 07:04:26 AM
I'm out of ideas. :(

I'll flag it in the "Helpers" board. :)
Title: Re: 404 - Attachment Not Found
Post by: emanuele on April 26, 2013, 07:33:41 AM
There is or have been a bug somewhere at some point during the updates/upgrades, don't know.

It's not the first time that I see the attachments hashes messed up, last time I tried to fix with a script that was supposed to re-hash the files, but I think I had problems and due to my lag spiros completed the re-upload before I was able to provide a working script.

Try the attached file, it *may* work, no warranties.
Try it locally of course first and take a full backup because it changes both the database and the attachments directory.

In order to use it you have to download one of the SMF converters (for example this (http://www.simplemachines.org/community/index.php?topic=477019.0)), extract it and upload the file convert.php along with the file attached here to your forum directory.
Then from your browser go to http://localhost/forum/convert.php or the appropriate host and directory. Let the converter run. See if it fixed anything.
Title: Re: 404 - Attachment Not Found
Post by: kat on April 26, 2013, 08:10:52 AM
Ta, Manny-baby! :)