Merge branch 'master' of https://github.com/Aevann1/Drama
This commit is contained in:
commit
845eb0391d
2 changed files with 10 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
import bleach
|
||||
from bs4 import BeautifulSoup
|
||||
from bleach.linkifier import LinkifyFilter
|
||||
from urllib.parse import ParseResult, urlunparse
|
||||
from urllib.parse import ParseResult, urlunparse, urlencode, urlparse, parse_qs
|
||||
from functools import partial
|
||||
from .get import *
|
||||
from os import path
|
||||
|
@ -205,6 +205,13 @@ def sanitize(text, linkgen=False, flair=False):
|
|||
|
||||
for i in re.finditer('(/comments/.*?)"', sanitized):
|
||||
url = i.group(1)
|
||||
if not "sort=" in url: sanitized = sanitized.replace(url, f"{url}?sort=controversial")
|
||||
p = urlparse(url).query
|
||||
p = parse_qs(p)
|
||||
|
||||
if 'sort' not in p:
|
||||
p['sort'] = ['controversial']
|
||||
|
||||
url_noquery = url.split('?')[0]
|
||||
sanitized = sanitized.replace(url, f"{url_noquery}?{urlencode(p, True)}")
|
||||
|
||||
return sanitized
|
|
@ -717,7 +717,6 @@ CREATE TABLE public.domains (
|
|||
can_submit boolean,
|
||||
can_comment boolean,
|
||||
reason integer,
|
||||
show_thumbnail boolean,
|
||||
embed_function character varying(64),
|
||||
embed_template character varying(32) DEFAULT NULL::character varying,
|
||||
sandbox_embed boolean DEFAULT false
|
||||
|
@ -870,7 +869,7 @@ CREATE TABLE public.modactions (
|
|||
target_comment_id integer,
|
||||
created_utc integer DEFAULT 0,
|
||||
kind character varying(32) DEFAULT NULL::character varying,
|
||||
_note character varying(256) DEFAULT NULL::character varying
|
||||
_note character varying(350) DEFAULT NULL::character varying
|
||||
);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue