diff --git a/routes.js b/routes.js index 67f7a6e..b24f161 100644 --- a/routes.js +++ b/routes.js @@ -925,7 +925,7 @@ module.exports = (app, redis, fetch, RedditAPI) => { json.suggested_subreddits = {} if(restrict_sr === 'off' && before == '' && after == '') { let url = `https://reddit.com/subreddits/search.json?q=${q}&include_over_18=${nsfw}&limit=3` - const response = await fetch(url) + const response = await fetch(encodeURI(url)) const data = await response.json() json.suggested_subreddits = data } diff --git a/views/search.pug b/views/search.pug index 6d2a12f..e3e1149 100644 --- a/views/search.pug +++ b/views/search.pug @@ -121,9 +121,9 @@ html h2 #{suggested_subreddit.data.display_name_prefixed}: #{cleanTitle(suggested_subreddit.data.title)} .sub-button if subbed_to_this_subreddit - a(href="/unsubscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "?q=" + q + "§nsfw=" + nsfw + "", class="sub-to-subreddit gray", title="subscriptions are saved in your browser's cookies") unsubscribe + a(href="/unsubscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "/search?q=" + q + "§nsfw=" + nsfw + "", class="sub-to-subreddit gray", title="subscriptions are saved in your browser's cookies") unsubscribe else - a(href="/subscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "?q=" + q + "§nsfw=" + nsfw + "", class="sub-to-subreddit", title="subscriptions are saved in your browser's cookies") subscribe + a(href="/subscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "/search?q=" + q + "§nsfw=" + nsfw + "", class="sub-to-subreddit", title="subscriptions are saved in your browser's cookies") subscribe .description p #{cleanTitle(suggested_subreddit.data.public_description)} .meta