Skip to content

Commit

Permalink
Merge pull request #201 from peskk3am/issue169
Browse files Browse the repository at this point in the history
Problem with % in file name fixed
  • Loading branch information
emanueldima committed Mar 25, 2014
2 parents 4ea49b3 + bd0fe3d commit e0084d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions invenio/lib/bibdocfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ def get_xml_8564(self):

for afile in self.list_latest_files(list_hidden=False):
out += '\t<datafield tag="856" ind1="4" ind2=" ">\n'
url = afile.get_url()
url = afile.get_full_url()
description = afile.get_description()
comment = afile.get_comment()
if url:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion invenio/lib/bibupload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e0084d5

Please sign in to comment.