Skip to content

Commit

Permalink
swift: Support mirabeta in handle404
Browse files Browse the repository at this point in the history
  • Loading branch information
paladox authored Nov 21, 2023
1 parent 7dde8ef commit f36cc4e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/swift/files/SwiftMedia/miraheze/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ def handle404(self, reqorig, url, container, obj):
r'^http://(?P<host>[^/]+)/(?P<proj>[^-/]+)/thumb/(?P<path>.+)',
encodedurl)
if match:
proj = match.group('proj').removesuffix("wiki")
hostname = '%s.miraheze.org' % (proj)
if match.group('proj').endswith('wikibeta'):
proj = match.group('proj').removesuffix("wiki")
hostname = '%s.mirabeta.org' % (proj)
else:
proj = match.group('proj').removesuffix("wikibeta")
hostname = '%s.miraheze.org' % (proj)
# ok, replace the URL with just the part starting with thumb/
# take off the first two parts of the path.
encodedurl = 'https://%s/w/thumb_handler.php/%s' % (
Expand Down

0 comments on commit f36cc4e

Please sign in to comment.