On sites where there is reputation restriction for embedding images, I (and others) will often edit posts from new users that include only a link to an image to embed the image (mostly this is on Stack Overflow). One way I commonly do this is by copying the image link at the bottom of the post. For example, this URL:

[1]: https://i.sstatic.net/someId.png

I then paste the URL using my keyboard only into the uploader, however, I often copy the space between the colon and the beginning of the URL from the post. When this is the case, when I paste the link, the site will automatically prepend "https://" before the whitespace, so you end up with something like this:

extra https image

Of course, this is an invalid URL, so the upload won't work until I intervene and remove the extra "https:// ".

I understand how prepending "https://" automatically could be helpful in some cases, but I was wondering if it was possible to detect if the URL being pasted has any preceding whitespace, and if so, strip it out and then see if https:// is already present or not? To be clear, I am only asking for this in the case of preceding whitespace - all other characters can/should maintain the current functionality.

Steps to reproduce

I can reproduce this by doing the following:

  1. Copy a URL of an image from a post with a whitespace character, such as this:


  1. Click the Image uploader icon.
  2. Paste using your keyboard Ctrl + V.

This .gif illustrates this behavior (and the steps):

steps to reproduce gif

  • I believe this is the works of some userscript. I can't reproduce what you describe. When I paste image URL into the editor, the URL is pasted as-is, no image upload pops up. If that's the case, should contact the userscript author(s) and ask them to add such feature. Commented Sep 19, 2022 at 14:01
  • @ShadowTheKidWizard also no repro when I click on the actual image button: i.sstatic.net/SIBkQ.gif Note: I also pressed Ctrl + V before clicking on the "paste" link and nothing happend (as can be seen in the GIF but not clear that I tried pasting). Using Firefox 104.
    – VLAZ
    Commented Sep 19, 2022 at 14:07
  • Why not just put an exclamation mark in the post before the actual image?
    – Luuklag
    Commented Sep 19, 2022 at 14:16
  • @VLAZ I believe I might of mixed up some of the functionality - I think the behavior I previously described was when you have an actual image (not url) copied to your clipboard. I edited my post - basically its whenever you try to paste a url into the uploader as described
    – Timothy G.
    Commented Sep 19, 2022 at 14:23
  • 1
    @Luuklag if you do that, isn't the image not clickable to enlarge?
    – Timothy G.
    Commented Sep 19, 2022 at 14:25
  • @TimothyG. I did try pasting the URL in the uploader. It's in the GIF. I clicked the image button -> pressed Ctrl + V which did nothing -> then I clicked "paste" (the link in the uploader) -> pasted the URL which includes a space in the beginning and showed the space existed. I did not get an extra "https://" appended
    – VLAZ
    Commented Sep 19, 2022 at 14:37
  • 1
    "if you do that, isn't the image not clickable to enlarge?" you can add the proper markdown to make it clickable: [text][1] becomes [![text][1]][1] -> ![text][1] to inline it and [...][1] to link it.
    – VLAZ
    Commented Sep 19, 2022 at 14:38
  • @VLAZ instead of clicking paste in the uploader, what happens if you just paste using your keyboard once you open the uploader control ?
    – Timothy G.
    Commented Sep 19, 2022 at 14:47
  • Nothing. Again, it's in the GIF. Well, the lack of anything happening is there. You just can't see me clicking Ctrl + V but I did: "I clicked the image button -> pressed Ctrl + V which did nothing -> then I clicked "paste" (the link in the uploader)"
    – VLAZ
    Commented Sep 19, 2022 at 14:50
  • 1
    Wait, I finally reproduced it. I had to click on the image button -> click on the dialog that shows up (not on any control inside it, just on blank space) -> press Ctrl + V. i.sstatic.net/3e6On.gif (yellow circle at the mouse cursor is me clicking)
    – VLAZ
    Commented Sep 19, 2022 at 14:51
  • @VLAZ I'm pretty sure I don't have to click anywhere in the control... I'll test it out in a bit and document the actual steps I take to reproduce.
    – Timothy G.
    Commented Sep 19, 2022 at 15:11
  • 1
    Note I don't think this is a bug. I assume the site prepends https:// as a feature, it's just a little unforgiving perhaps :)
    – Timothy G.
    Commented Sep 19, 2022 at 16:45
  • 1
    It's preferable that you don't it the way you've described. If you do it that way, then anyone looking at the diff for the edit (e.g. either as a suggested edit or in the post's history) will see that you changed the underlying image, rather than just changing the Markdown to show the image inline. They then need to investigate if the image actually changed, which takes significant time as they have to inspect it enough to draw the conclusion that you didn't actually change anything in the image.
    – Makyen
    Commented Sep 19, 2022 at 22:31
  • @Makyen the imgur URL remains the same. It doesn't actually make a new one if that is what you mean (imgur must know if you use a stack.imgur link to just reuse the link). So the only thing that happens in the Edit is the image gets embedded using the same URL that the OP created.
    – Timothy G.
    Commented Sep 19, 2022 at 22:41
  • @TimothyG.I must admit that I haven't tried it. It's that I've reviewed a bunch of suggested edits and/or seen edits in post histories which are claiming that they are just inlining the image, but where the ID within the image's URL on imgur does change, but the image is an exact match. I've assumed that for those edits the users are just doing what you've described in the question. Maybe it's been changed by SE and I'm just remembering a long history of something that no longer happens.
    – Makyen
    Commented Sep 19, 2022 at 23:55


You must log in to answer this question.

Browse other questions tagged .