Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 37512:aac97d043e6d
hgweb: drop archivespecs from requestcontext
It's a constant.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 01 Apr 2018 22:33:55 +0900 |
parents | 876d54f800cf |
children | f83cb91b052e |
comparison
equal
deleted
inserted
replaced
37511:356e61e82c2a | 37512:aac97d043e6d |
---|---|
1162 | 1162 |
1163 type_ = web.req.qsparams.get('type') | 1163 type_ = web.req.qsparams.get('type') |
1164 allowed = web.configlist("web", "allow_archive") | 1164 allowed = web.configlist("web", "allow_archive") |
1165 key = web.req.qsparams['node'] | 1165 key = web.req.qsparams['node'] |
1166 | 1166 |
1167 if type_ not in web.archivespecs: | 1167 if type_ not in webutil.archivespecs: |
1168 msg = 'Unsupported archive type: %s' % type_ | 1168 msg = 'Unsupported archive type: %s' % type_ |
1169 raise ErrorResponse(HTTP_NOT_FOUND, msg) | 1169 raise ErrorResponse(HTTP_NOT_FOUND, msg) |
1170 | 1170 |
1171 if not ((type_ in allowed or | 1171 if not ((type_ in allowed or |
1172 web.configbool("web", "allow" + type_))): | 1172 web.configbool("web", "allow" + type_))): |
1191 files = [f for f in ctx.manifest().keys() if match(f)] | 1191 files = [f for f in ctx.manifest().keys() if match(f)] |
1192 if not files: | 1192 if not files: |
1193 raise ErrorResponse(HTTP_NOT_FOUND, | 1193 raise ErrorResponse(HTTP_NOT_FOUND, |
1194 'file(s) not found: %s' % file) | 1194 'file(s) not found: %s' % file) |
1195 | 1195 |
1196 mimetype, artype, extension, encoding = web.archivespecs[type_] | 1196 mimetype, artype, extension, encoding = webutil.archivespecs[type_] |
1197 | 1197 |
1198 web.res.headers['Content-Type'] = mimetype | 1198 web.res.headers['Content-Type'] = mimetype |
1199 web.res.headers['Content-Disposition'] = 'attachment; filename=%s%s' % ( | 1199 web.res.headers['Content-Disposition'] = 'attachment; filename=%s%s' % ( |
1200 name, extension) | 1200 name, extension) |
1201 | 1201 |