Skip to content
This repository was archived by the owner on Dec 17, 2022. It is now read-only.

Commit 723b4b8

Browse files
committed
Fix bug shortening Citi URLs
1 parent 35a9cd1 commit 723b4b8

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

bitlyshortener/shortener.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,8 @@ def _shorten_url(self, long_url: str) -> str: # pylint: disable=too-many-locals
203203
short_url = response_json["link"]
204204

205205
# Postprocess short URL
206-
assert short_url.startswith("https://")
207-
# if short_url.startswith('http://'):
208-
# short_url = short_url.replace('http://', 'https://', 1)
206+
if short_url.startswith("http://"): # Example: http://citi.us/2FPqsuZ
207+
short_url = short_url.replace("http://", "https://", 1)
209208
if (not self._vanitize) or (self._vanitize and short_url.startswith("https://bit.ly/")):
210209
url_id = short_url.rpartition("/")[-1]
211210
short_url = f"https://j.mp/{url_id}"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ ignore = D100,D101,D102,D103,D104,D105,D106,D107,D203,D213
2222

2323
[tool:pytest]
2424
addopts = --isort --mccabe --mypy --pycodestyle --pydocstyle --pylint --ignore=archive
25-
mccabe-complexity=12
25+
mccabe-complexity=13

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def parse_requirements(filename: str) -> List[str]:
1818
name="bitlyshortener",
1919
author="Ouroboros Chrysopoeia",
2020
author_email="[email protected]",
21-
version="0.4.1",
21+
version="0.4.2",
2222
description="High-volume Bitly V4 URL shortener with memory-cache",
2323
keywords="bitly url shortener",
2424
long_description=(_DIR / "README.md").read_text().strip(),

0 commit comments

Comments
 (0)