Skip to content

Attachment server fails on URLs with diacritics #13

@loveablelobster

Description

@loveablelobster

The Specify attachment server responds with an internal server error if the downloadname param contains UTF-8 diacritics (Specify 6 has no problems with this). So this request will work:

www.example.com/fileget?coll=Our+Whales+&type=O&filename=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.pdf&downloadname=Modtagelse+af+hvaler+1.pdf&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

While this will throw an error:
www.example.com/fileget?coll=Our+Whales+&type=O&filename=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.att.pdf&downloadname=Journal+på+sæler+-+vedhæftninger%5CNr.+2%5CVægt+%2B+foderskemaer.pdf&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Stack trace for the exmapel above:

Traceback (most recent call last):
  File "/home/specify/web-asset-server/bottle.py", line 856, in _handle
    return route.call(**args)
  File "/home/specify/web-asset-server/bottle.py", line 1716, in wrapper
    rv = callback(*a, **ka)
  File "/home/specify/web-asset-server/server.py", line 114, in wrapper
    result = func(*args, **kwargs)
  File "/home/specify/web-asset-server/server.py", line 104, in wrapper
    return func(*args, **kwargs)
  File "/home/specify/web-asset-server/server.py", line 213, in fileget
    download_name = quote(path.basename(download_name))
  File "/usr/lib64/python2.7/urllib.py", line 1283, in quote
    return ''.join(map(quoter, s))
KeyError: u'\xe5'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions