News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Images not renaming

Started by barrie, August 26, 2022, 04:13:48 AM

Previous topic - Next topic

barrie

Hi Guys, our forum at https://www.aircooledrdclub.com/smf has had an issue for a while that now needs more attention. I believe that when a member uploads an image the software automatically renames it to prevent overwriting images with the same name but ours does not do this and we are getting close to 50,000 images ! We have asked members to rename images with something random like drghh6u8jbbn.jpg but many of them are Luddites and its not in their capability. Can someone point me in the direction as to how we overcome this ? All help is much appreciated.

Steve

Your forum is 2.0.15 which is 4 versions behind in the 2.0 series. You're missing some very important security updates. I highly recommend upgrading to 2.0.19 and consider going to 2.1.2.
DO NOT pm me for support!

barrie

Thanks for the reply. I am not very technical. I look after the Forum after the passing of the guy who set it up. Is it just a case of downloading the next version from within the Forum and installing it and then the next version etc ? Excuse my ignorance.

Steve

Go to Admin -> Package Manager and it will show what the next version is and give you a link to install it. Keep doing this until you reach 2.0.19.
DO NOT pm me for support!

barrie

Thanks again. First upgrade did not go well as I got errors in line 38 : ./Sources/Profile/-Modify.php
Test failed

I will make a back up first but its 700mb so may take a while.

Think I may be out of my depth here !!


Doug Heffernan

Quote from: barrie on August 26, 2022, 08:44:07 AMThanks again. First upgrade did not go well as I got errors in line 38 : ./Sources/Profile/-Modify.php
Test failed

I will make a back up first but its 700mb so may take a while.

Think I may be out of my depth here !!



Click the icon next to the rror message and it will tell you what needs to be changed and where. You can apply the changes manually to the file(s) mentioned in the error.

My advice, if I may, is to upgrade to 2.1.2, as @Steve mentioned above. This upgrade is done manually. For more info please see this link:

Upgrading SMF

Something to note, all mods and themes for 2.0.x are not compatible with the 2.1.x serie.

Sir Osis of Liver

Attachment file names are hashed when they're uploaded for security reasons, you can see that in /attachments directory.  Having users rename their files before upload accomplishes nothing.  Upgrading to 2.1 before resolving this problem may not be the best idea, as the upgrade renames the attachments by adding a .dat extension.  If you're already having difficulties with file names, upgrading could make it worse.  I would clone the forum and run upgrade on the clone before attempting it on production install.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

GL700Wing

#7
Quote from: barrie on August 26, 2022, 04:13:48 AMHi Guys, our forum at https://www.aircooledrdclub.com/smf has had an issue for a while that now needs more attention.
Hi @barrie
Are you able to provide details of what the problem actually is (eg, whenever a member tries to do A, B happens)?

I'm guessing it relates to attachments but are members able to successfully attach files to messages?, do attached files display correctly in messages?, and/or are members able to download attached files?  Is the issue affecting all messages, members, attachment types or just some?

Also, I've had a look at your forum (as a guest) and I can see that it is for a 50+ year old series of motorcycles which means many of your members are probably 70+ years old (and some are probably in their 80s and 90s).  I own/manage a forum for a 40+ year old series of motorcycles (I set the forum up 15 years ago) and I know that many of my members (most of whom are 60+ years old) would struggle with the very different look and feel of SMF 2.1.x - especially the attachments interface.  Based on this my recommendation is that, and for security reasons, you consider upgrading to al least SMF 2.0.19.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Kindred

See the faq entry regarding "errors during mid installation" regarding your patch error...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Illori

take a look at https://www.simplemachines.org/community/index.php?topic=573100.0

you will need to check for attachmentEncryptFilenames in the settings table in your database.

barrie

Quote from: GL700Wing on August 26, 2022, 05:10:54 PM
Quote from: barrie on August 26, 2022, 04:13:48 AMHi Guys, our forum at https://www.aircooledrdclub.com/smf has had an issue for a while that now needs more attention.
Hi @barrie
Are you able to provide details of what the problem actually is (eg, whenever a member tries to do A, B happens)?

I'm guessing it relates to attachments but are members able to successfully attach files to messages?, do attached files display correctly in messages?, and/or are members able to download attached files?  Is the issue affecting all messages, members, attachment types or just some?

Also, I've had a look at your forum (as a guest) and I can see that it is for a 50+ year old series of motorcycles which means many of your members are probably 70+ years old (and some are probably in their 80s and 90s).  I own/manage a forum for a 40+ year old series of motorcycles (I set the forum up 15 years ago) and I know that many of my members (most of whom are 60+ years old) would struggle with the very different look and feel of SMF 2.1.x - especially the attachments interface.  Based on this my recommendation is that, and for security reasons, you consider upgrading to al least SMF 2.0.19.

When a member uploads an attachment for example called yamaha.jpg if there is already an attachment with the same name it overwrites it causing great confusion for posts going back many years !!

Illori

did you look at the link i provided above?

barrie

Quote from: Illori on August 27, 2022, 05:32:39 AMdid you look at the link i provided above?

Yes and many thanks. As mentioned, this is all new to me so I need to get my head around all these strange files with the codes in. I am really nervous about changing anything  :P

Illori

then do a backup first.

https://wiki.simplemachines.org/smf/Backup

in this case you need to modify the database, so you really need to do a database backup first.

Sir Osis of Liver

Quote from: barrie on August 27, 2022, 05:01:02 AMWhen a member uploads an attachment for example called yamaha.jpg if there is already an attachment with the same name it overwrites it causing great confusion for posts going back many years !!

That doesn't happen in 2.0.19 -

You cannot view this attachment.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

GL700Wing

Quote from: Sir Osis of Liver on August 27, 2022, 11:17:30 PM
Quote from: barrie on August 27, 2022, 05:01:02 AMWhen a member uploads an attachment for example called yamaha.jpg if there is already an attachment with the same name it overwrites it causing great confusion for posts going back many years !!
That doesn't happen in 2.0.19 -
Apparently this can happen in SMF 2.0.19 if the setting attachmentEncryptFilenames is missing from the smf_settings table (or it has a value of 0) - more information in the What can cause error message "Sorry! There is already an attachment..."? topic @Illori has referred to a couple of times ...

Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Sir Osis of Liver

Hmm, didn't think that would apply to this situation, but setting attachmentEncryptFilenames = 0 replicates the problem.  If that's no longer an admin option, and filenames are always hashed in 2.0, why is the setting still used?  And it would have to carry over from a 1.1 install to be set to 0, as there's no way to set it in 2.0.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

GL700Wing

Quote from: Sir Osis of Liver on August 28, 2022, 12:05:16 AMHmm, didn't think that would apply to this situation, but setting attachmentEncryptFilenames = 0 replicates the problem.  If that's no longer an admin option, and filenames are always hashed in 2.0, why is that setting still used?  And it would have to carry over from a 1.1 install to be set to 0, as there's no way to set it in 2.0.
The oldest topics on the affected forum date back to SMF 1.x when hashing attachment filenames was optional.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Sir Osis of Liver

Do the unhashed files still display correctly after upgrading to 2.0?  If OP changes the setting to 1, will that affect unhashed files?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

GL700Wing

#19
Quote from: Sir Osis of Liver on August 28, 2022, 12:21:48 AMDo the unhashed files still display correctly after upgrading to 2.0?  If OP changes the setting to 1, will that affect unhashed files?
I'm just testing that now with SMF 2.0.19 but the weird thing is that even if the setting attachmentEncryptFilenames is missing or has a value of '0' the attachment filename is actually hashed/encrypted and the hashed/encrypted file name is stored as 'file_hash' in the 'attachments' table and the attachment name in the 'attachments' folder is the hashed/encrypted file name.

Maybe the empty($modSettings['attachmentEncryptFilenames']) checks in Subs-Post.php and Subs.php need to be reviewed ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: