Skip to content

Commit

Permalink
Fix reddit 301-ing when the last slash is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ubershmekel committed Aug 11, 2023
1 parent 28b9cfc commit ee86dd1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,12 @@ $(function () {
subredditUrl = "/r/" + rp.photos[0].subreddit;
}

// Note that JSONP requests require `".json?jsonp=?"` here.
// Seems since sometime in 2023:
// Works - https://www.reddit.com/r/aww/.json?
// Fails - https://www.reddit.com/r/aww.json?
if (subredditUrl.length > 0 && subredditUrl[subredditUrl.length - 1] !== "/") {
subredditUrl += "/";
}
var jsonUrl = embedit.redditBaseUrl + subredditUrl + ".json?" + (rp.session.after ? rp.session.after + "&" : "") + getVars;

var failedAjax = function (/*data*/) {
Expand Down

0 comments on commit ee86dd1

Please sign in to comment.