Advertisement:

Author Topic: Sharing a post to reddit is only submitting a partial URL  (Read 317 times)

Offline Wellwisher

  • Full Member
  • ***
  • Posts: 448
  • Gender: Male
Sharing a post to reddit is only submitting a partial URL
« on: January 23, 2021, 08:46:23 PM »
I am making a social Reddit share button. The issue is when I click on "Share on Reddit" it only records a partial SMF topic post URL on reddit EXAMPLE.

Here's my JSfiddle example which replicates the issue:

https://jsfiddle.net/doLwkc92/

So on reddit if the actual forum post url is say for EXAMPLE:

"https://www.website.com/forum/index.php?topic=876.msg104178%23msg104178"

When shared on reddit, it only records:

"https://www.website.com/forum/index.php"

However here's where it gets interesting, when a user shares a forum post on reddit, it doesn't "submit" the full post URL, but if they refresh the reddit page (once u share it), it fixes itself automatically.  :-\


Below is the actual PHP code used in my forum:

Code: [Select]

<li><a href="https://www.reddit.com/submit?title='. urlencode($context['subject']) .'&amp;url=', $scripturl, '?topic=', $context['current_topic'], '.msg' . $message['id'] . '%23msg' . $message['id'] . '" title="Share on Reddit" target="_blank"><i class="fa  fa-reddit-alien"></i></a></li>


I believe the problem may be the "URL decoder" not working properly on Reddit but not sure.
« Last Edit: January 23, 2021, 08:59:34 PM by Wellwisher »

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 60,073
  • Gender: Male
    • Kindred-999 on GitHub
Re: Sharing a post to reddit is only submitting a partial URL
« Reply #1 on: January 23, 2021, 08:57:52 PM »
Its a reddit problem with the ? and & argument notations
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."

Offline Wellwisher

  • Full Member
  • ***
  • Posts: 448
  • Gender: Male
Re: Sharing a post to reddit is only submitting a partial URL
« Reply #2 on: January 23, 2021, 09:01:13 PM »
Its a reddit problem with the ? and & argument notations

Ah thank you @Kindred, so I wasn't going crazy, I suspected it as much because when you refresh the reddit page, it fixes itself.

It's the "?", "&", "=" that's throwing reddit off.

Is there a fix for this issue?
« Last Edit: January 23, 2021, 09:34:07 PM by Wellwisher »

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 60,073
  • Gender: Male
    • Kindred-999 on GitHub
Re: Sharing a post to reddit is only submitting a partial URL
« Reply #3 on: January 23, 2021, 09:08:24 PM »
It's not an smf problem

You could use pretty URLs
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."

Offline Wellwisher

  • Full Member
  • ***
  • Posts: 448
  • Gender: Male
Re: Sharing a post to reddit is only submitting a partial URL
« Reply #4 on: January 23, 2021, 09:16:17 PM »
It's not an smf problem

You could use pretty URLs

It's a neat idea. I would as it's a clever little add on. However it doesn't play well with SMF updates and other addons made for SMF.

Thank you for your input Kindred, as usual I really appreciate it. I will submit a bug report to reddit.  :P Much respect mate.