Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: Imago on September 10, 2022, 11:47:55 PM

Title: Attachments: File not found
Post by: Imago on September 10, 2022, 11:47:55 PM
Files are there, names and addresses are correct in the form of /index.php?action=dlattach;topic=1805.0;attach=397 - but when you click you get an empty page with "File not found."

All this after the upgrade to 2.1.2

Is there any way to re-index the attachments directory?
Title: Re: Attachments: File not found
Post by: Sir Osis of Liver on September 11, 2022, 12:04:14 AM
Do all the hashed filenames have a .dat extension?
Title: Re: Attachments: File not found
Post by: Imago on September 11, 2022, 04:43:00 AM
Not at all, Sir.
Title: Re: Attachments: File not found
Post by: Kindred on September 11, 2022, 01:32:26 PM
That's the problem then
Title: Re: Attachments: File not found
Post by: Doug Heffernan on September 11, 2022, 02:36:42 PM
I think that this is the bug with the attachments being gone after upgrading to 2.1.2. from 2.0.x and even older versions.

Title: Re: Attachments: File not found
Post by: Sir Osis of Liver on September 11, 2022, 03:55:36 PM
Upload attached script to forum root, run it with direct link.  It will add .dat extension to those files that don't have it.
Title: Re: Attachments: File not found
Post by: Chen Zhen on September 11, 2022, 05:13:40 PM

You should use an identical comparison operator ( === ) for the srpos() function else there may be an unintended result.
Title: Re: Attachments: File not found
Post by: Sir Osis of Liver on September 11, 2022, 05:22:43 PM
Will try it, thanks.

Revised script attached.
Title: Re: Attachments: File not found
Post by: Sir Osis of Liver on September 11, 2022, 06:13:32 PM
Quote from: Doug Heffernan on September 11, 2022, 02:36:42 PMI think that this is the bug with the attachments being gone after upgrading to 2.1.2. from 2.0.x and even older versions.

Why does it happen only on a few forums?
Title: Re: Attachments: File not found
Post by: shawnb61 on September 11, 2022, 07:53:30 PM
I'm not aware of a specific bug where a 2.1 upgrade loses pix.

The upgrader is definitely sensitive to improper settings, e.g., if the attachment folders are incorrect.  This can happen after a forum move/restore; you should run repair_settings.php prior to upgrading to ensure smf knows where your folders are - esp attachments...

You absolutely MUST be upgrading a fully working forum, with proper settings & folders, or bad things happen...

The upgrader is also sensitive to certain types of db changes that cause the upgrader to crash.  Anything that would cause the sql to fail, e.g., removed columns or tables. Columns added by mods with no default, etc.
Title: Re: Attachments: File not found
Post by: Imago on September 12, 2022, 03:59:01 AM
Quote from: Sir Osis of Liver on September 11, 2022, 05:22:43 PMWill try it, thanks.

Revised script attached.

.dat has been added to all attachments. The result is still File not found.

The upgrade was from 1.1.21 and many times stuck at saving hash for attachments.

What if I install Attachment Browser, let it add all tags and save?
Title: Re: Attachments: File not found
Post by: Imago on September 12, 2022, 06:32:47 AM
Quote from: Imago on September 12, 2022, 03:59:01 AM
Quote from: Sir Osis of Liver on September 11, 2022, 05:22:43 PMWill try it, thanks.

Revised script attached.

.dat has been added to all attachments. The result is still File not found.

Except for some 30 files from 2009 that somehow have been saved with their hash instead of real name. They are now downloadable.
Title: Re: Attachments: File not found
Post by: Sir Osis of Liver on September 12, 2022, 12:24:14 PM
Have you tried upgrading 1.1.21 to 2.0.19?

Post screenshot of your /attachments.
Title: Re: Attachments: File not found
Post by: Imago on September 12, 2022, 02:16:21 PM
Yes, many times - always with encoding errors.

This is the /attachments. From 405 to 465 files are downloadable. All other files containing the name or both the name and the hash are not found.

(https://snipboard.io/tPQE6A.jpg)

Title: Re: Attachments: File not found
Post by: Sir Osis of Liver on September 12, 2022, 09:57:28 PM
If that's from 2.1.2, upgrade did not complete.  Avatars should have been moved from /attachments to /custom_avatar.  They are now broken because .dat extension was added to the existing extension.  You'll have to revert to 1.1.21, make sure it's working correctly.

PM sent.
Title: Re: Attachments: File not found
Post by: Imago on September 15, 2022, 04:22:34 AM
UPDATE: Managed to upgrade to 2.0.19 by replacing the russian language file with russian-utf8 file. For some reason the russian, as well as the bulgarian language files for versions under 2.1.x are utf8 encoded w/o BOM, but do not allow of UTF-8, so you have to install the specific -utf8 files.

In 2.0.19 all attachments and avatars are available and visible.

Upgrade to 2.1.2 went flawlessly - except for attachments and avatars.

Fixed the attachments with the attachfix2.php - thanks to Sir Osis of Liver! - and now what remains unfixed is the avatar location. They are still in the /avatar dir but are not displayed. There is nothing in the /custom_avatar

PS. Moved whatever avatar available to /custom_avatar and now Oll is Korrect :-)
Title: Re: Attachments: File not found
Post by: Steve on September 15, 2022, 07:05:00 AM
Quote from: Imago on September 15, 2022, 04:22:34 AMPS. Moved whatever avatar available to /custom_avatar and now Oll is Korrect :-)
Does that mean this can be marked solved?
Title: Re: Attachments: File not found
Post by: Imago on September 15, 2022, 07:23:07 AM
Yes, it is solved. Thank you!
Title: Re: Attachments: File not found
Post by: Kindred on September 15, 2022, 08:20:52 AM
BTW 2.1.x uses ALL UTF8. There are no ISO files in 2.1.x