mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 06:48:01 -05:00
Method _key_from_url() now returns case sensitive results for special domains (e.g. imgur.com, youtube.com). They are defined as case_sensitive_domains in the .ini file
This commit is contained in:
3
r2/example.ini
Normal file → Executable file
3
r2/example.ini
Normal file → Executable file
@@ -375,6 +375,9 @@ share_reply = noreply@reddit.com
|
||||
# feedback email
|
||||
feedback_email = reddit@gmail.com
|
||||
|
||||
# Special case sensitive domains
|
||||
case_sensitive_domains = i.imgur.com, youtube.com
|
||||
|
||||
[server:main]
|
||||
use = egg:Paste#http
|
||||
host = 0.0.0.0
|
||||
|
||||
3
r2/r2/lib/app_globals.py
Normal file → Executable file
3
r2/r2/lib/app_globals.py
Normal file → Executable file
@@ -110,7 +110,8 @@ class Globals(object):
|
||||
'authorized_cnames',
|
||||
'hardcache_categories',
|
||||
'proxy_addr',
|
||||
'allowed_pay_countries']
|
||||
'allowed_pay_countries',
|
||||
'case_sensitive_domains']
|
||||
|
||||
choice_props = {'cassandra_rcl': {'ONE': CL_ONE,
|
||||
'QUORUM': CL_QUORUM},
|
||||
|
||||
8
r2/r2/models/link.py
Normal file → Executable file
8
r2/r2/models/link.py
Normal file → Executable file
@@ -538,7 +538,13 @@ class LinksByUrl(tdb_cassandra.View):
|
||||
|
||||
@classmethod
|
||||
def _key_from_url(cls, url):
|
||||
keyurl = _force_utf8(UrlParser.base_url(url.lower()))
|
||||
if not utils.domain(url) in g.case_sensitive_domains:
|
||||
keyurl = _force_utf8(UrlParser.base_url(url.lower()))
|
||||
else:
|
||||
# Convert only hostname to lowercase
|
||||
up = UrlParser(url)
|
||||
up.hostname = up.hostname.lower()
|
||||
keyurl = _force_utf8(UrlParser.base_url(up.unparse()))
|
||||
return keyurl
|
||||
|
||||
# Note that there are no instances of PromotedLink or LinkCompressed,
|
||||
|
||||
Reference in New Issue
Block a user