News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Wrong attachment size

Started by darkmoon2010, August 17, 2023, 02:23:59 AM

Previous topic - Next topic

darkmoon2010

Hi,
I recognized a wrong attachment size is shown (calculated) for attachments.

You cannot view this attachment.


This wrong size is shown for all files which shouldbe attached. Enclosed you will find a screenshot.

How can this be fixed ?

SMF is on 2.1.4 and we don't have any mods active.

Best regards
Thomas

Kindred

I don't think that's the wrong size...
Сл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."

darkmoon2010

Why?

The attachment itself is 0,1MB and the summary shows 0,1KB and in total you can upload 4.5MB and the summary shows 4.5kb.

So for me the summary is not correct.

darkmoon2010

The enclosed hardcopy is taken from our board and not from the smf-forum.  :laugh:
In our board there is a mismatch between filesize and the summary shown below the attachments.

@rjen

Have you tried switching to ENGLISH?

It may be a translation eroor in the German language pack?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

darkmoon2010

I switched to ENGLISH now and it is still the same.

darkmoon2010

I made some further investigation and the summary issue occured after updating from SMF 2.1.3 to 2.1.4.

Seems there was a change in attachment handling.

darkmoon2010

Hi Guys,
now I made some more investigation and found out the following:

I installed a fresh SMF 2.1.3 right out of the box without changing anything.
Only the settings for attachment size and amount was adjusted:
You cannot view this attachment.

At this point the attachment summary looks pretty good. Each size for every attachment is shown correctly and also the summary is ok.

You cannot view this attachment.

Now I performed an upgrade from SMF 2.1.3 to 2.1.4 and recognized each size for every attachment is shown correctly but the summary is wrong (kb instead of MB).

You cannot view this attachment.

At least I installed SMF 2.1.4 right out of the box and the behaviour is still the same as after upgrading from 2.1.3 to 2.1.4. For me it looks like the conversion from kb to MB is not correct working.

You cannot view this attachment.

Can you please check this and give me a solution ?

Thanks in advance.


Aleksi "Lex" Kilpinen

Could you try clearing your browser's temporary files, or do a hard refresh on the updated forum, and check to see if this behaviour is still there after that.

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

How you can help SMF

darkmoon2010

I cleared the browser's temporary files (Safari, Chrome,...) and nothing changed.
The behaviour is still the same, sorry.

What do you mean with a hard refresh on the updated forum ?
How should I do this ?

For my test I deleted the updated forum and installed a fresh 2.1.4.on my test environment.


Aleksi "Lex" Kilpinen

That's enough, clearing the temporary files is the better option of those two.

@Sesquipedalian Ideas? I seem to remember you were familiar with this part of the code :)
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

How you can help SMF

Sesquipedalian

#11
How odd.

I cannot reproduce the problem in my tests, so it looks like something unusual is happening with your forum in particular, @darkmoon2010.

First, let's look at what might be the simplest explanation. Please check these lines in your index.{language}.php file to make sure that they are using the correct values. (Since you said that the problem is the same in English and your primary language, this probably isn't the cause, but it is worth checking.)

If those values are correct, then we can move on to the next step, which is examining your Post.php file to see if there is anything unusual happening in it. For that, it will probably be easiest if you simply attach a copy of the file to your reply so that I can look at it. You can find the file inside the Sources folder.

Never mind, I take it all back. I was able to reproduce the problem after all. This is a bug in SMF.

@darkmoon2010, please go to this line in your Post.php file and test the following change:

Code (Find) Select
text_max_size_progress: ' . JavaScriptEscape('{currentRemain} ' . ($modSettings[$type] >= 1024 ? $txt['megabyte'] : $txt['kilobyte']) . ' / {currentTotal} ' . ($modSettings[$type] >= 1024 ? $txt['megabyte'] : $txt['kilobyte'])) . ',

Code (Replace) Select
text_max_size_progress: ' . JavaScriptEscape('{currentRemain} ' . ($modSettings['attachmentPostLimit'] >= 1024 ? $txt['megabyte'] : $txt['kilobyte']) . ' / {currentTotal} ' . ($modSettings['attachmentPostLimit'] >= 1024 ? $txt['megabyte'] : $txt['kilobyte'])) . ',
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

darkmoon2010

Hi Sesquipedalian,
this was the solution, the fix works in my test-forum and also in our productive forum.

You cannot view this attachment.

Many thanks for the quick and professional support.

For me the case is closed.

Best regards
Thomas

Sesquipedalian

Glad to hear it, @darkmoon2010.

I have submitted the same change for inclusion in SMF 2.1.5.

For you, that means that in order to install the 2.1.5 patch, you will first need to manually revert that line back to its original 2.1.4 version and then install the patch to reapply the change we just made.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Advertisement: