Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 51bcbfbc97e8fe33c1b6ec34b70119e76c849f99 1 parent 1b030c3
@bsimpson63 bsimpson63 authored
View
3  r2/example.ini 100644 → 100755
@@ -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
View
3  r2/r2/lib/app_globals.py 100644 → 100755
@@ -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},
View
8 r2/r2/models/link.py 100644 → 100755
@@ -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,
Please sign in to comment.
Something went wrong with that request. Please try again.