diff --git a/invenio/lib/bibdocfile.py b/invenio/lib/bibdocfile.py index 15084a28a3..f940a1b717 100644 --- a/invenio/lib/bibdocfile.py +++ b/invenio/lib/bibdocfile.py @@ -743,7 +743,7 @@ def get_xml_8564(self): for afile in self.list_latest_files(list_hidden=False): out += '\t\n' - url = afile.get_url() + url = afile.get_full_url() description = afile.get_description() comment = afile.get_comment() if url: @@ -2901,12 +2901,13 @@ def __init__(self, fullpath, recid_doctypes, version, docformat, docid, status, self.cd = self.md self.dir = os.path.dirname(fullpath) + url_name = urllib.quote(self.name) if self.subformat: - self.url = create_url('/%s/%s/files/%s%s' % (CFG_SITE_RECORD, self.recids_doctypes[0][0], self.name, self.superformat), {'subformat' : self.subformat}) - self.fullurl = create_url('/%s/%s/files/%s%s' % (CFG_SITE_RECORD, self.recids_doctypes[0][0], self.name, self.superformat), {'subformat' : self.subformat, 'version' : self.version}) + self.url = create_url('/%s/%s/files/%s%s' % (CFG_SITE_RECORD, self.recids_doctypes[0][0], url_name, self.superformat), {'subformat' : self.subformat}) + self.fullurl = create_url('%s/%s/%s/files/%s%s' % (CFG_SITE_SECURE_URL, CFG_SITE_RECORD, self.recids_doctypes[0][0], url_name, self.superformat), {'subformat' : self.subformat, 'version' : self.version}) else: - self.url = create_url('/%s/%s/files/%s%s' % (CFG_SITE_RECORD, self.recids_doctypes[0][0], self.name, self.superformat), {}) - self.fullurl = create_url('/%s/%s/files/%s%s' % (CFG_SITE_RECORD, self.recids_doctypes[0][0], self.name, self.superformat), {'version' : self.version}) + self.url = create_url('/%s/%s/files/%s%s' % (CFG_SITE_RECORD, self.recids_doctypes[0][0], url_name, self.superformat), {}) + self.fullurl = create_url('%s/%s/%s/files/%s%s' % (CFG_SITE_SECURE_URL, CFG_SITE_RECORD, self.recids_doctypes[0][0], url_name, self.superformat), {'version' : self.version}) self.etag = '"%i%s%i"' % (self.docid, self.format, self.version) self.magic = None @@ -2971,6 +2972,10 @@ def hidden_p(self): def get_url(self): return self.url + def get_full_url(self): + """Returns absolute url.""" + return self.fullurl + def get_type(self): """Returns the first type connected with the bibdoc of this file.""" return self.recids_doctypes[0][1] diff --git a/invenio/lib/bibupload.py b/invenio/lib/bibupload.py index 09c68ce5a0..05bec12d93 100644 --- a/invenio/lib/bibupload.py +++ b/invenio/lib/bibupload.py @@ -1375,7 +1375,7 @@ def get_bibdocfile_managed_info(): bibrecdocs = BibRecDocs(rec_id) latest_files = bibrecdocs.list_latest_files(list_hidden=False) for afile in latest_files: - url = afile.get_url() + url = afile.get_full_url() ret[url] = {'u': url} description = afile.get_description() comment = afile.get_comment()