encode url for fetching suggested subreddits
This commit is contained in:
parent
9b14f25d31
commit
543f01641c
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue