Content server: Fix ugly URLs for specific format download in the book details and permalink panels

This commit is contained in:
Kovid Goyal 2012-01-14 11:00:42 +05:30
parent 6c595afc21
commit 00653e3646

View File

@ -669,10 +669,15 @@ class BrowseServer(object):
args = {'id':id_, 'mi':mi,
}
ccache = self.categories_cache() if add_category_links else {}
ftitle = fauthors = ''
for key in mi.all_field_keys():
val = mi.format_field(key)[1]
if not val:
val = ''
if key == 'title':
ftitle = xml(val, True)
elif key == 'authors':
fauthors = xml(val, True)
if add_category_links:
added_key = False
fm = mi.metadata_for_field(key)
@ -710,8 +715,8 @@ class BrowseServer(object):
args[key] = xml(val, True)
else:
args[key] = xml(val, True)
fname = quote(ascii_filename(args['title']) + ' - ' +
ascii_filename(args['authors']))
fname = quote(ascii_filename(ftitle) + ' - ' +
ascii_filename(fauthors))
return args, fmt, fmts, fname
@Endpoint(mimetype='application/json; charset=utf-8')