News:

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

Main Menu

Confusing behaviour when embedded attachment is deleted

Started by Sir Osis of Liver, May 19, 2022, 06:57:41 PM

Previous topic - Next topic

Sir Osis of Liver

Quote inserted for context after topic was split
Quote from: Sir Osis of Liver on May 19, 2022, 06:06:01 PMOr you can do this - You cannot view this attachment. with a tooltip.  ;) 

Quote from: Sesquipedalian on May 19, 2022, 12:27:12 AMAnyone who doesn't like the current behaviour can change it on their own install.
Sure, but we shouldn't have to.

Just as an aside, when I preview this post I get 'Not a valid attachment ID.' instead of the image.  It posted correctly, now it doesn't.

As expected, 2.1 is a mess. :P




Here's what's in the post -


Or you can do this - [attach id=281552]butt_ss1.png[/attach] with a tooltip.


If it wasn't a valid attachment thumb wouldn't work.

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

                                     - R. Waters

FrizzleFried

The tag at can be fixed by changing 281552 to 281554. 

I am not sure why the tag ended up 2 numbers below your image number unless you'd attached an image... then deleted it... then re-uploaded an image and left the original tag?

Sir Osis of Liver

Didn't post the insert first try, uploaded it several times to try to get it to post correctly. 
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sesquipedalian

Quote from: Sir Osis of Liver on May 19, 2022, 06:06:01 PM
Quote from: Sesquipedalian on May 19, 2022, 12:27:12 AMAnyone who doesn't like the current behaviour can change it on their own install.
Sure, but we shouldn't have to.



Quote from: Sir Osis of Liver on May 19, 2022, 06:06:01 PMJust as an aside, when I preview this post I get 'Not a valid attachment ID.' instead of the image.  It posted correctly, now it doesn't.

You have the wrong number specified in the id parameter of the attach BBCode. I suspect that you attached a file, inserted the BBCode, accidentally deleted the attachment, and then uploaded a fresh copy of the file. Or perhaps you were working in source view instead of WYSIWYG mode and simply made a typo. Either way, correct the id number in your post, and it'll work just fine.
I promise you nothing.

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

Sir Osis of Liver

Not a typo, nothing to do with WYSIWYG.  Just trying to attach a png, like any other dumb member, didn't work.  Bad enough it's poorly designed, it's buggy as well.  Not on my computer so can't replicate the glitch, will try tomorrow (if I remember).
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Aleksi "Lex" Kilpinen

Looks like you previewed the post with Attachment id 281552,
but before you actually made the post it ID the attachment eventually had climbed to 281554.
I'm not sure what caused that, but it's worth looking at IMO @Sesquipedalian

EDIT: I was slow and missed the second page completely before posting :P Sorry about 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

Sesquipedalian

Quote from: Aleksi "Lex" Kilpinen on May 20, 2022, 12:28:45 AMbefore you actually made the post it ID the attachment eventually had climbed to 281554.
I'm not sure what caused that, but it's worth looking at IMO @Sesquipedalian

That can't happen. Every attachment, even if it is just a preview that is discarded before the post is submitted, is assigned a unique, permanent ID number. That ID number will never change, no matter how many other attachments might be uploaded before the post is submitted.

Since Sir Osis said that he uploaded copies of the file several times, the only explanation I can see is the scenario that both I and FrizzleFried described:

Quote from: FrizzleFried on May 19, 2022, 06:58:11 PMI am not sure why the tag ended up 2 numbers below your image number unless you'd attached an image... then deleted it... then re-uploaded an image and left the original tag?
Quote from: Sesquipedalian on May 19, 2022, 07:50:19 PMI suspect that you attached a file, inserted the BBCode, accidentally deleted the attachment, and then uploaded a fresh copy of the file.
I promise you nothing.

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

Sesquipedalian

#7
Thinking more about it, Sir Osis' confusion probably arose because the editor's thumbnail preview does not disappear when an attachment is deleted. We could improve that by adding some JavaScript to remove the attach BBC from the post text in the editor when the attachment is deleted.
I promise you nothing.

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

@rjen

This exact same problem is reported to me as well by forum users. It seems to happen more often
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Sesquipedalian

I promise you nothing.

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

Antechinus

If you're interested, there's a simple CSS tweak which will also immediately hide the deleted ones in the attachments preview:
.dz-complete.errorbox {
display: none;
}

I'm running it on local already, and I'm liking it quite a lot. ;)

Sir Osis of Liver

#11
IIRC, first attempt to insert the image failed.

It's failed again in preview, first upload, no delete - You cannot view this attachment.

But as you can see it posted correctly.

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

                                     - R. Waters

Sir Osis of Liver

test - You cannot view this attachment.

Fails every time.  Add file > Upload > Insert > Preview

You cannot view this attachment.

Posts ok.

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

                                     - R. Waters

Sir Osis of Liver

The ui is unecessarily complicated.  There are seven buttons after you've added one file, two more for each additional file.  Uploading should not be a separate step, once added all attachments should upload on post, as in 2.0.  That would greatly simplify things.  It's ridiculous the way it is now.


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

                                     - R. Waters

Arantor

There is actually one side point to this method - though certainly not this presentation - that you can theoretically handle attachments that are larger than the server would normally let you upload in one go.

We haven't seen that for a while as a support question - I guess hosts are more lax than they used to be - but there was a time you couldn't upload several files together because it'd be too big for the server to cope with in a single go. Which is what this was *trying* to deal with.

But there are vastly better ways of presenting this.

FrizzleFried


Antechinus

Quote from: Arantor on May 20, 2022, 01:22:34 PMThere is actually one side point to this method - though certainly not this presentation - that you can theoretically handle attachments that are larger than the server would normally let you upload in one go.

We haven't seen that for a while as a support question - I guess hosts are more lax than they used to be - but there was a time you couldn't upload several files together because it'd be too big for the server to cope with in a single go. Which is what this was *trying* to deal with.
It's a fair point, and one that may not be relevant to hosts anymore but can still be relevant to connections, especially on mobile. I'm not that fussed about having to have an upload button if the  "Upload all" option is available (and obviously available) for connections that can deal with it.

Arantor

You could still have upload all do it out of band and return the ids for inclusion into the post. It's still bad UX even taking that factor into account and it can and I would argue should be improved.

Antechinus


Sir Osis of Liver

Quote from: Sesquipedalian on May 20, 2022, 01:28:25 AMThinking more about it, Sir Osis' confusion probably arose because the editor's thumbnail preview does not disappear when an attachment is deleted.

I'm not confused, the f@#king thing doesn't work.  Nothing to do with deleting attachement, as posted above, it doesn't work.

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

                                     - R. Waters

FrizzleFried

(1) Upload (just did that)

(2) Insert: 

You cannot view this attachment.

(3) Preview:

You cannot view this attachment.

(4) OP is 100% correct.  This behavior is not correct.   

Antechinus

I have no idea what you mean. All I see is two inline attachments in this post, and a screenshot of the editor. Try using more words. :P

ETA: Oh hang on, the error box in the preview shot. Got it.

Funnily enough, I had an error with the attachments system on a local test site the other night. I have not yet tried to replicate it, because honestly I think the only way of replicating it would be by repeatedly adding and removing attachment until it randomly happens again, and that could take ages. However...

I was testing adding and removing attachments (tweaking presentation) and I uploaded a new attachment, inserted it into the test post by clicking the insert button, and after saving the post I was presented with the "No message is associated with this attachment" message inside the post.

So, I go back into the editor to check it out, and I find that the attachment was inserted with its ID number off by 1. Note that this cannot possibly be a manual editing error, because the insertion was done via the insert button. So. it was handled directly by the SMF back end with no possibility for human error.

Despite this, it still came up with "ID + 1" for the value it inserted into the post.

Obvious question: is Ant hallucinating? Not unless Arantor is too, because I mentioned this to him via PM and he said he has occasionally seen the same error. Nothing in the error log either, before anyone asks.

Sir Osis of Liver

Nothing occasional about it, happens every time -

You cannot view this attachment.


Add file > upload > insert > preview



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

                                     - R. Waters

Antechinus

I didn't preview though. I just uploaded, inserted, and saved. So, different issue.

ETA: Just tried doing a test your way on local. No problem. Preview works as it should. Saved post is fine. So, not an "all the time" issue for everyone.

Sir Osis of Liver

It's an attachment id error, that shouldn't be client side.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

FrizzleFried

Oddly... while this issue is 100% repeatable HERE for me.  Every time.  I have ZERO issue with the same exact procedure on both my sandbox and main sites...

So I can't explain it unless it's a permissions issue as I obviously don't have admin access here.  Maybe when I have a little time I'll test as a user on my sites.


Antechinus


Antechinus

You cannot view this attachment.

Yup. Confirmed. Immediate hit here. FIrefox on W10.

But, it only affects the preview. The submitted post is fine.

FrizzleFried

FWIW ... I just tried a USER account at my main site and in both WYSIWYG and TEXT MODE editors using the exact procedure above that I have the same result as OP here with... I have no issues at all on my local site.

FrizzleFried

Quote from: Antechinus on May 21, 2022, 11:44:17 PMYou cannot view this attachment.

Yup. Confirmed. Immediate hit here. FIrefox on W10.

But, it only affects the preview. The submitted post is fine.

Correct... exact same behavior I experience here ... but on Chrome.  I do NOT experience this same behavior on either of my local sites using either editor it seems.

Sir Osis of Liver

Confirmed, doesn't happen on 2.1 test install, only here.

Running a later version here?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

FrizzleFried

Oh,  I should mention that my sandbox site is 2.1.2 and main site is 2.1.1 so it's not a version thing.

Sir Osis of Liver

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

                                     - R. Waters

Oldiesmann

I was able to reproduce the problem on my test board. Running the latest code from GitHub, PHP 8.1.6, MariaDB 10.3.34, APCu caching. Interesting how it shows just fine in WYSIWYG mode but not when I preview it.

You cannot view this attachment.
Michael Eshom
Christian Metal Fans

Sesquipedalian

Okay, to summarize, this bug occurs consistently for people on this site, but not on their own sites and test installs, except for Oldiesmann. Is that correct, everyone?

@Oldiesmann:

  • In that screenshot, the BBCode string in the attachment info box says the attachment ID number is 6. Is 6 really the correct ID number for the attachment, or should it have been 4 or 5 or something else?
  • Do you see any difference in behaviour if the editor is in WYSIWYG mode vs. source mode when you click the INSERT button and then generate the preview?
  • Am I correct to assume that the test forum has no mods installed?

@Sir Osis of Liver: When I said "confusion" I was not trying to deny that you were seeing what you were seeing. It was simply that the only way I could reproduce the same output on my test install was to delete and reattach a file, and because the editor's thumbnail preview was not deleted when I performed those steps—which is indeed confusing to anyone—I supposed that this confusing behaviour of the UI was the source of the problem.
I promise you nothing.

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

Oldiesmann

Quote from: Sesquipedalian on May 24, 2022, 11:54:08 AMOkay, to summarize, this bug occurs consistently for people on this site, but not on their own sites and test installs, except for Oldiesmann. Is that correct, everyone?

@Oldiesmann:

  • In that screenshot, the BBCode string in the attachment info box says the attachment ID number is 6. Is 6 really the correct ID number for the attachment, or should it have been 4 or 5 or something else?
  • Do you see any difference in behaviour if the editor is in WYSIWYG mode vs. source mode when you click the INSERT button and then generate the preview?
  • Am I correct to assume that the test forum has no mods installed?

6 is the correct ID for that attachment. 7 is the thumbnail for that one.
No difference between the two modes
No mods installed at the moment. It has had mods installed at other times though.
Michael Eshom
Christian Metal Fans

Sir Osis of Liver

Works correctly on clean 2.1.2 install from current upgrade package.  Doesn't work here.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shawnb61

#37
Quote from: Sir Osis of Liver on May 24, 2022, 05:11:50 PMWorks correctly on clean 2.1.2 install from current upgrade package.  Doesn't work here.

Yep.  That's exactly why some (like me... ::)) couldn't reproduce.  The issues were primarily in current GitHub, and this site is often closer to current GH than 2.1.2. 

PR submitted: https://github.com/SimpleMachines/SMF/pull/7497
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

shawnb61

The upload/insert/preview issue should be addressed on this site.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Sir Osis of Liver

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

                                     - R. Waters

Arantor

Uh... is it? See attached.

That attachment produces a 404 when clicked, but it's still in the attachments table.

Arantor

Hm, seems like it might be fixed now, now I see an image and it's not 404ing.

Sir Osis of Liver

Server glitch?  Works for me.  Original problem was only in preview, posting was normal.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Steve

So this topic is solved? I can't keep up with you coders.  :P
DO NOT pm me for support!

Sir Osis of Liver

The preview problem seems to be fixed, but Arantor may have found another glitch.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

There was definitely a glitch when it was announced as fixed on here - I think there may be some residual issues with old attachments vs the mod site, but I have no solid feelings on what causes what yet.

Arantor

I am still seeing glitches, e.g. in https://www.simplemachines.org/community/index.php?msg=4127833 there is an attachment, it has a thumbnail, but opening the full size attachment gets a 404.

And the image is attempting to embed inside the post - and failing also with a 404.

Something isn't right here.

FrizzleFried

Quote from: Arantor on June 07, 2022, 08:22:56 AMI am still seeing glitches, e.g. in https://www.simplemachines.org/community/index.php?msg=4127833 there is an attachment, it has a thumbnail, but opening the full size attachment gets a 404.

And the image is attempting to embed inside the post - and failing also with a 404.

Something isn't right here.

What is strange is that I see that post fine.  The behavior seems to be a DELAY between when the post is made and when the image actually appears for folks.  I saw that happen in "real time" with an attachment earlier (and commented about it as did others).

The attachment didn't show for me... for minutes... then all of a sudden... it did.

Here is what I see at the link above:

You cannot view this attachment.

Arantor

Weird, it's there now for me too. Which really doesn't make sense, because 10 minutes after it was definitely 404ing for me and offhand I can't fathom why that would happen, not even related to background tasks happening.

FrizzleFried

When I saw it in real-time... a post was made a minute or two before I saw exactly what you saw.  I fuddled around for a couple minutes hard refreshing, etc... but it would not come up.  So I posted about it.  Someone else posted they saw the same thing... then... a few minutes later... there it was... for both of us.

Let me see if I can find the post/response.


EDIT: Here it is - https://www.simplemachines.org/community/index.php?msg=4126787


shawnb61

We believe the occasional 404s on this site have been addressed.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Sir Osis of Liver

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

                                     - R. Waters

shawnb61

Site/server side stuff.  Over my head, tbh.

The mod site was impacted as well.  But all appears to be good now.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: