Skip to content

Commit

Permalink
Make the better URL feature work properly
Browse files Browse the repository at this point in the history
Closes mozilla#655.
  • Loading branch information
martinthomson committed Apr 24, 2023
1 parent 5bfb066 commit d2111f9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,11 @@ def fetch_spec_data(self, url):
try:
spec_data = self.parser().parse(soup, url)
except BetterUrl as why:
new_url = why[0]
sys.stderr.write("* Trying <%s>...\n" % new_url)
if why.args[0] == url:
sys.stderr.write("*** BUG: proposing the same URL as better.\n")
raise why
new_url = why.args[0]
sys.stderr.write("* Using better URL: <%s>...\n" % new_url)
spec_data = self.fetch_spec_data(new_url)
except FetchError:
sys.stderr.write("* Falling back.\n")
Expand Down Expand Up @@ -434,9 +437,9 @@ def parse(self, spec, url_string):
this_url = self.get_link(spec, "^This version")
latest_url = self.get_link(spec, "^Latest version")
ed_url = self.get_link(spec, "^Editor's draft")
if ed_url and ed_url != this_url:
if ed_url and ed_url != url_string:
raise BetterUrl(ed_url)
elif latest_url and latest_url != this_url:
elif latest_url and latest_url != url_string:
raise BetterUrl(latest_url)
elif this_url:
data["url"] = this_url
Expand Down

0 comments on commit d2111f9

Please sign in to comment.