UNSOLVED

hdawood

updated

16 years ago

H

hdawood

3 Posts

0

2286

February 6th, 2011 15:00

Dealing with special charactes in uploaded filenames

Hello all,

As mentioned in the subject line, how does one deal with special characters in filenames that have already been uploaded to Atmos?

The Programmer's Guide does not specifically deal with this issue. I have only found reference implementations (AtmosFox, Gladinet, PHP Bindings, EMC Atmos Object Browser, XCloud cmd-line utility etc.) and almost all of them handle this by urlencode()'ing the filename when uploading. Therefore, you're able to successfully upload a file to Atmos with the following name:

  Ampersands & Special Characters.txt

However, during the retrieval process (directory listing or file download) all the above clients fail one way or another:

1. Gladinet doesn't even use the /rest/namespace interface. They use the object interface with the filename as a listable tag which itself is stripped of spaces and special chars encoded appropriately. Therefore this client is not affected.

2. AtmosFox's XML parser simply fails and complains about the "&" in the filename.

3. EMC Atmos Object browser also fails with the error: "Error parsing response".

4. The cmd-line utility XCloud uses the PHP bindings by simply wrapping the string you provide as the filename into an ObjectPath(). Once the bindings try to download the file, you get the following error from Atmos: "Error 1032: There was a mismatch between the signature in the request and the signature computed by the server."

Trying to use the REST interface manually (say via cURL) you get the same error as the PHP bindings, regardless of how you encode the filename:

1. Ampersands+%26+Special+Characters.txt

2. Ampersands%20%26%20Special%20Characters.txt

3. Ampersands %26 Special Characters.txt

4. etc.

I have at this point come to the conclusion that there is no way to retrieve a file with special chars in its name once it has been uploaded to Atmos. However, before I give up and inform my clients of this gotcha, I wanted to see if anyone here has dealt with this issue before. Or if someone officially from EMC can shed some light on this issue.

To replicate, upload a file using either "AtmosFox" or the "EMC Atmos Object Browser". Once the file has uploaded successfully, try to either perform a directory listing on the path where you uploaded the file, or simply try to download the file by providing the full path in any of the above mentioned utilities.

  • rbala1

    1 Rookie

    •

    222 Posts

    319

    0

    Posted February 7th, 2011 12:00

    Hey there,

    Are you accessing Atmos at a service provider partner of ours?  If so which provider?

    I'm using Atmos Online and I can urlencode the resource for the actual http request to create the object and it works successfully for me.  I can also list the contents of the directory and read the actual object contents itself.

    It's possible that those tools aren't handling the special characters properly.  I'm fairly certain that AtmosFox does not --- I can try to get that resolved, but it won't happen very quickly.

    Here's an example of my POST request to create the object:

    POST /rest/namespace/namespacedirectory/Ampersands%20%26%20Special%20Characters.txt HTTP/1.1
    Accept-Encoding: identity
    Content-Length: 7
    X-Emc-Signature: iSwttJWdYr7GwtLWIANDOEeVcbo=
    Connection: close
    User-Agent: Python-urllib/2.7
    Host: accesspoint.emccis.com
    Date: Mon, 07 Feb 2011 20:47:46 GMT
    X-Emc-Uid: d131c2805d244b1a9e91aefb4b545ebc/NA000FBBFE5BE6CEBFBE
    Content-Type: application/octet-stream
    X-Emc-Date: Mon, 07 Feb 2011 20:47:46 GMT

    And here's the response when I try to list the direcory with that object:

    HTTP/1.1 200 OK
    Date: Mon, 07 Feb 2011 20:47:47 GMT
    Server: Apache
    x-emc-groupacl: other=NONE
    x-emc-useracl: NA000FBBFE5BE6CEBFBE=FULL_CONTROL
    x-emc-policy: _int
    x-emc-meta: atime=2011-02-07T20:47:46Z, mtime=2011-02-07T20:47:47Z, ctime=2011-02-07T20:47:47Z, itime=2011-02-07T20:47:47Z, type=directory, uid=NA000FBBFE5BE6CEBFBE, gid=apache, objectid=4980cdb2a510109604d3f4c609b96004d505a730534f, objname=namespacedirectory, size=4096, nlink=1, policyname=default
    Content-Length: 352
    Connection: close
    Content-Type: text/xml



       
       
            4980cdb2aa10109904d38eb9bd39fc04d505a73b1c27
             regular
             Ampersands & Special Characters.txt
       
       

    Here's the response to read the object:

    HTTP/1.1 200 OK
    Date: Mon, 07 Feb 2011 20:52:01 GMT
    Server: Apache
    x-emc-policy: default
    Content-Length: 7
    x-emc-groupacl: other=NONE
    x-emc-useracl: NA000FBBFE5BE6CEBFBE=FULL_CONTROL
    x-emc-meta: atime=2011-02-07T20:47:47Z, mtime=2011-02-07T20:47:47Z, ctime=2011-02-07T20:47:47Z, itime=2011-02-07T20:47:47Z, type=regular, uid=NA000FBBFE5BE6CEBFBE, gid=apache, objectid=4980cdb2aa10109904d38eb9bd39fc04d505a73b1c27, objname=Ampersands & Special Characters.txt, size=7, nlink=1, policyname=default
    Connection: close
    Content-Type: application/octet-stream

  • hdawood

    3 Posts

    319

    0

    Posted February 7th, 2011 20:00

    Hi rbala,


    Thanks for a detailed response. Can you show me your URI when you try and retrieve the file as mentioned in your 3rd step?


    I mentioned in my initial post that I tried different variations of /rest/namespace/:fileName, where :fileName was:


    1. Ampersands%20%26%20Special%20Characters.txt
    2. Ampersands %26 Special Characters.txt
    3.
    Ampersands+%26+Special+Characters.txt

    But all the above returned a signature mismatch error from Atmos.

    I'm using Atmos v.1.3.0 as deployed by PEER 1 Hosting (not AtmosOnline with EMC).

  • rbala1

    1 Rookie

    •

    222 Posts

    319

    0

    Posted February 8th, 2011 05:00

    Sorry that I didn't include that earlier.  Here is the HTTP request, response, and the string that's being signed to read the object in the namespace.  BTW, I am using the Python wrapper which you can get from trunk.

    The request:

    GET /rest/namespace/namespacedirectory/Ampersands%20%26%20Special%20Characters.txt HTTP/1.1
    Accept-Encoding: identity
    X-Emc-Signature: ODApz82A1spGn/aezTCZXitmILo=
    Connection: close
    User-Agent: Python-urllib/2.7
    Host: accesspoint.emccis.com
    Date: Tue, 08 Feb 2011 13:11:27 GMT
    X-Emc-Uid: d131c2805d244b1a9e91aefb4b545ebc/NA000FBBFE5BE6CEBFBE
    Content-Type: application/octet-stream
    X-Emc-Date: Tue, 08 Feb 2011 13:11:27 GMT

    Here's the response:

    HTTP/1.1 200 OK
    Date: Tue, 08 Feb 2011 13:11:27 GMT
    Server: Apache
    x-emc-policy: default
    Content-Length: 7
    x-emc-groupacl: other=NONE
    x-emc-useracl: NA000FBBFE5BE6CEBFBE=FULL_CONTROL
    x-emc-meta: atime=2011-02-07T20:47:47Z, mtime=2011-02-07T20:47:47Z, ctime=2011-02-07T20:47:47Z, itime=2011-02-07T20:47:47Z, type=regular, uid=NA000FBBFE5BE6CEBFBE, gid=apache, objectid=4980cdb2aa10109904d38eb9bd39fc04d505a73b1c27, objname=Ampersands & Special Characters.txt, size=7, nlink=1, policyname=default
    Connection: close
    Content-Type: application/octet-stream

    Here's the string I am signing for the request:

    GET
    application/octet-stream

    Tue, 08 Feb 2011 13:11:27 GMT
    /rest/namespace/namespacedirectory/ampersands & special characters.txt
    x-emc-date:Tue, 08 Feb 2011 13:11:27 GMT
    x-emc-uid:d131c2805d244b1a9e91aefb4b545ebc/NA000FBBFE5BE6CEBFBE
    x-emc-signature:ODApz82A1spGn/aezTCZXitmILo=

    Raj