Skip to content

Commit

Permalink
fixed extension
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Mar 31, 2017
1 parent 1426aaf commit 5fa2c36
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pywps/app/Service.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,11 @@ def _get_complex_input_handler(self, href):
def href_handler(complexinput, datain):
"""<wps:Reference /> handler"""
# save the reference input in workdir
extension = None
if hasattr(complexinput, 'data_format') and complexinput.data_format.extension:
extension = complexinput.data_format.extension
tmp_file = _build_input_file_name(
datain.get('href'), complexinput.workdir)
href=datain.get('href'), workdir=complexinput.workdir, extension=extension)

try:
(reference_file, reference_file_data) = _openurl(datain)
Expand Down Expand Up @@ -654,14 +657,11 @@ def _get_datasize(reference_file_data):
return data_size


def _build_input_file_name(href, workdir):
def _build_input_file_name(href, workdir, extension=None):
href = href or ''
file_name = os.path.basename(href).strip() or 'input'
(prefix, suffix) = os.path.splitext(file_name)
if not suffix:
suffix = ''
if hasattr(complexinput, 'data_format') and complexinput.data_format.extension:
suffix = complexinput.data_format.extension
suffix = suffix or extension
file_name = prefix + suffix
input_file_name = os.path.join(workdir, file_name)
# build tempfile in case of duplicates
Expand Down

0 comments on commit 5fa2c36

Please sign in to comment.