Index: trunk/extensions/SwiftMedia/wmf/rewrite.py |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | # http://upload.wikimedia.org/wikipedia/commons/a/aa/000_Finlanda_harta.PNG |
170 | 170 | # http://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/000_Finlanda_harta.PNG/75px-000_Finlanda_harta.PNG |
171 | 171 | # http://upload.wikimedia.org/wikipedia/commons/thumb/archive/b/b6/20101108115418!Gilbert_Stuart_Williamstown_Portrait_of_George_Washington.jpg/100px-Gilbert_Stuart_Williamstown_Portrait_of_George_Washington.jpg |
172 | | - match = re.match(r'/(?P<proj>.*?)/(?P<lang>.*?)/(?P<thumb>thumb/)?(?P<shard>./../)?(?P<path>.*)', req.path) |
| 172 | + match = re.match(r'/(?P<proj>.*?)/(?P<lang>.*?)/(?P<thumb>thumb/)?(?P<archive>(temp|archive)/)?(?P<shard>./../)?(?P<path>.*)', req.path) |
173 | 173 | if match: |
174 | 174 | # Our target URL is as follows (example): |
175 | 175 | # https://alsted.wikimedia.org:8080/v1/AUTH_6790933748e741268babd69804c6298b/wikipedia-en-25/Machinesmith.png |
— | — | @@ -180,12 +180,16 @@ |
181 | 181 | thumb = match.group('thumb') |
182 | 182 | shard = match.group('shard') |
183 | 183 | obj = match.group('path') |
| 184 | + arch = match.group('archive') |
184 | 185 | # include the thumb in the container. |
185 | 186 | if thumb: #03 |
186 | 187 | container += "-thumb" |
187 | 188 | if shard: |
188 | 189 | #add only the 2-digit shard to the container name |
189 | 190 | container += "-%s" % shard[2:4] |
| 191 | + if arch: |
| 192 | + # for urls that go /wiki/thumb/archive/a/ab/path, the container is wiki-thumb-ab and the obj is archive/path |
| 193 | + obj = "%s%s" % (arch, obj) |
190 | 194 | |
191 | 195 | if not obj: |
192 | 196 | # don't let them list the container (it's CRAZY huge) #08 |