File tree Expand file tree Collapse file tree 3 files changed +5
-21
lines changed
Expand file tree Collapse file tree 3 files changed +5
-21
lines changed Original file line number Diff line number Diff line change 1+ # 0.2.3
2+
3+ - Do not process unrecognized href, i.e. pointing outside iFixit
4+
15# 0.2.2
26
37- Fixed URL normalization on articles redirecting outside domain (help.ifixit.com)
Original file line number Diff line number Diff line change 1- 0.2.1
1+ 0.2.3
Original file line number Diff line number Diff line change @@ -241,26 +241,6 @@ def _process_external_url(url, rel_prefix):
241241
242242 @staticmethod
243243 def _process_unrecognized_href (url , rel_prefix ):
244- if not url .startswith ("https://" ) and not url .startswith ("http://" ):
245- return Global ._process_external_url (url , rel_prefix )
246- try :
247- resp = requests .head (url , timeout = 5 )
248- headers = resp .headers
249- except requests .exceptions .ConnectionError :
250- logger .debug (f"Unable to HEAD unrecognized href (ConnectionError): { url } " )
251- return Global ._process_external_url (url , rel_prefix )
252- except requests .exceptions .ReadTimeout :
253- logger .debug (f"Unable to HEAD unrecognized href (ReadTimeout): { url } " )
254- return Global ._process_external_url (url , rel_prefix )
255- except Exception as exc :
256- logger .warning (f"Unable to HEAD unrecognized href: { url } " )
257- logger .exception (exc )
258- return Global ._process_external_url (url , rel_prefix )
259-
260- contentType = headers .get ("Content-Type" )
261- if contentType and contentType .startswith ("image/" ):
262- return f"{ rel_prefix } { Global .get_image_path (url )} "
263-
264244 return Global ._process_external_url (url , rel_prefix )
265245
266246 def _process_href_regex_dynamics (href , rel_prefix ):
You can’t perform that action at this time.
0 commit comments