diff --git a/pygmy/app/link.py b/pygmy/app/link.py index 221a12f..7db6f7a 100644 --- a/pygmy/app/link.py +++ b/pygmy/app/link.py @@ -130,6 +130,10 @@ def formatted_link_stats(link): 'time_series_base': click_meta.get('time_base'), 'time_stats': click_meta.get('timestamp_hits', {}), } + + # Hide original/long_url in case of protected links + if link.is_protected is True: + link_info['long_url'] = '' return {**link_info, **click_info} diff --git a/pygmy/rest/shorturl.py b/pygmy/rest/shorturl.py index 590bbc2..fd616f9 100644 --- a/pygmy/rest/shorturl.py +++ b/pygmy/rest/shorturl.py @@ -98,8 +98,6 @@ def resolve(code): secret_key = request.headers.get('secret_key') try: # check if link is not a secret link - long_url = resolve_short( - code.strip('+'), secret_key=secret_key) if code.startswith('+') or code.endswith('+'): stats = link_stats(code) response = jsonify(stats) diff --git a/pygmy/utilities/urls.py b/pygmy/utilities/urls.py index 18fd769..0d891b5 100644 --- a/pygmy/utilities/urls.py +++ b/pygmy/utilities/urls.py @@ -26,10 +26,7 @@ def validate_url(url): def make_short_url(short_path): - short_url = urljoin( - config.pygmy['short_url_schema'], - config.pygmy['short_url'], - short_path) + short_url = urljoin('{}{}'.format(config.pygmy['short_url_schema'], config.pygmy['short_url']), short_path) return short_url diff --git a/pygmyui/templates/base.html b/pygmyui/templates/base.html index c829112..42867be 100644 --- a/pygmyui/templates/base.html +++ b/pygmyui/templates/base.html @@ -74,7 +74,7 @@