edina / fieldtrip-cobweb-project

A cobweb theme for fieldtrip app
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Encoding/Decoding spaces in the record/editor names #20

Closed rgamez closed 10 years ago

rgamez commented 10 years ago

When a record is renamed the new name is not being properly encoded causing problems to retrieve it

Example: If I upload a duplicated record, for example: Image (24-10-2014 11h30m52s) the pcapi rename it as:

{
    "msg": "File uploaded",
    "path": "/records/Image%20(24-10-2014%2011h30m52s) (1)/record.json",
    "error": 0
}

For displaying a human readable name in the mobile app we decode that name:

decodeURIComponent("Image%20(24-10-2014%2011h30m52s) (1)")
"Image (24-10-2014 11h30m52s) (1)"

But after that, the PCAPI doesn't recognize it anymore, because if we encode it back, it has an extra %20 and that path doesn't exist in the local provider.

encodeURIComponent("Image (24-10-2014 11h30m52s) (1)")
"Image%20(24-10-2014%2011h30m52s)%20(1)"

What would be the desired behaviour? fully encoded, fully decoded or something else