From b2961c1d993cc52fde59f85f02698cf26233380a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 6 Oct 2022 06:10:21 +0000 Subject: [PATCH 1/2] sneed --- schema.sql | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/schema.sql b/schema.sql index 20cb4f743c..8069745952 100644 --- a/schema.sql +++ b/schema.sql @@ -561,6 +561,19 @@ CREATE TABLE public.marseys ( ); +-- +-- Name: media; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.media ( + kind character varying(5) NOT NULL, + filename character varying(23) NOT NULL, + user_id integer NOT NULL, + created_utc integer NOT NULL, + size integer NOT NULL +); + + -- -- Name: modactions; Type: TABLE; Schema: public; Owner: - -- @@ -1319,6 +1332,14 @@ ALTER TABLE ONLY public.marseys ADD CONSTRAINT marseys_pkey PRIMARY KEY (name); +-- +-- Name: media media_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media + ADD CONSTRAINT media_pkey PRIMARY KEY (kind, filename); + + -- -- Name: modactions modactions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2352,6 +2373,14 @@ ALTER TABLE ONLY public.marseys ADD CONSTRAINT marsey_submitter_fkey FOREIGN KEY (submitter_id) REFERENCES public.users(id); +-- +-- Name: media media_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media + ADD CONSTRAINT media_user_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); + + -- -- Name: mods mod_sub_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- From 4e23161f1169405997e18478d7ecbc67e960ec9b Mon Sep 17 00:00:00 2001 From: official-techsupport <98240022+official-techsupport@users.noreply.github.com> Date: Thu, 6 Oct 2022 09:17:28 +0300 Subject: [PATCH 2/2] Re-enable showmore_regex for Snappy (#389) * Re-enable showmore_regex for Snappy * showmore a bit more aggressively --- files/helpers/regex.py | 4 ++-- files/helpers/sanitize.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 5f91c930b9..4f68ca1de3 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -95,8 +95,8 @@ reddit_domain_regex = re.compile("(^|\s|\()https?:\/\/(reddit\.com|(?:(?:[A-z]{2 color_regex = re.compile("[a-z0-9]{6}", flags=re.A) # lazy match on the {}?, only match if there is trailing stuff -# don't match between nested

etc, this can break but works for Snappy -showmore_regex = re.compile(r"^(.{3000,}?

)(\s*

.*)", flags=re.A|re.DOTALL) +# Specifically match Snappy's way of formatting, this might break some losers' comments. +showmore_regex = re.compile(r"^(.{3000,}?

(?:)?)(\s*

.*)", flags=re.A|re.DOTALL) search_token_regex = re.compile('"([^"]*)"|(\S+)', flags=re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 966ba07e13..5d2867b6d9 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -386,7 +386,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys if '

' not in sanitized:
 		sanitized = sanitized.replace('\n','')
 
-	if showmore and len(sanitized) > 5000:
+	if showmore and len(sanitized) > 3500:
 		sanitized = showmore_regex.sub(r'\1

\2', sanitized, count=1) return sanitized.strip()