Index: trunk/extensions/SwiftMedia/wmf/tests/rewriteRegexTest.py |
— | — | @@ -4,18 +4,16 @@ |
5 | 5 | # (a) http://upload.wikimedia.org/<proj>/<lang>/.* |
6 | 6 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/.* |
7 | 7 | # (b) http://upload.wikimedia.org/<proj>/<lang>/archive/.* |
8 | | -# => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/archive.* |
| 8 | +# => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/archive/.* |
9 | 9 | # (c) http://upload.wikimedia.org/<proj>/<lang>/thumb/.* |
10 | 10 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/.* |
11 | 11 | # (d) http://upload.wikimedia.org/<proj>/<lang>/thumb/archive/.* |
12 | 12 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/archive/.* |
13 | | -# (e) http://upload.wikimedia.org/<proj>/<lang>/thumb/temp/.* |
14 | | -# => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/temp/.* |
15 | | -# (f) http://upload.wikimedia.org/<proj>/<lang>/temp/.* |
| 13 | +# (e) http://upload.wikimedia.org/<proj>/<lang>/temp/.* |
16 | 14 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-temp/.* |
17 | 15 | |
18 | 16 | # The regex to test (for rewrite.py) |
19 | | -regex = r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>((temp|archive)/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$' |
| 17 | +regex = r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>(archive/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$' |
20 | 18 | |
21 | 19 | # [url,proj,lang,zone,shard,path] |
22 | 20 | cases = [] |
— | — | @@ -27,8 +25,6 @@ |
28 | 26 | 'wikipedia', 'commons', 'thumb', 'ab', 'a/ab/file.jpg'] ) |
29 | 27 | cases.append( ['/wikipedia/commons/thumb/archive/a/ab/file.jpg', |
30 | 28 | 'wikipedia', 'commons', 'thumb', 'ab', 'archive/a/ab/file.jpg'] ) |
31 | | -cases.append( ['/wikipedia/commons/thumb/temp/a/ab/file.jpg', |
32 | | - 'wikipedia', 'commons', 'thumb', 'ab', 'temp/a/ab/file.jpg'] ) |
33 | 29 | cases.append( ['/wikipedia/commons/temp/a/ab/file.jpg', |
34 | 30 | 'wikipedia', 'commons', 'temp', 'ab', 'a/ab/file.jpg'] ) |
35 | 31 | |
Index: trunk/extensions/SwiftMedia/wmf/rewrite.py |
— | — | @@ -177,16 +177,14 @@ |
178 | 178 | # (a) http://upload.wikimedia.org/<proj>/<lang>/.* |
179 | 179 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/.* |
180 | 180 | # (b) http://upload.wikimedia.org/<proj>/<lang>/archive/.* |
181 | | - # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/archive.* |
| 181 | + # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/archive/.* |
182 | 182 | # (c) http://upload.wikimedia.org/<proj>/<lang>/thumb/.* |
183 | 183 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/.* |
184 | 184 | # (d) http://upload.wikimedia.org/<proj>/<lang>/thumb/archive/.* |
185 | 185 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/archive/.* |
186 | | - # (e) http://upload.wikimedia.org/<proj>/<lang>/thumb/temp/.* |
187 | | - # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/temp/.* |
188 | | - # (f) http://upload.wikimedia.org/<proj>/<lang>/temp/.* |
| 186 | + # (e) http://upload.wikimedia.org/<proj>/<lang>/temp/.* |
189 | 187 | # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-temp/.* |
190 | | - match = re.match(r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>((temp|archive)/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$', req.path) |
| 188 | + match = re.match(r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>(archive/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$', req.path) |
191 | 189 | if match: |
192 | 190 | # Get the repo zone (if not provided that means "public") |
193 | 191 | zone = match.group('zone') if match.group('zone') else 'public' |