bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #35701] Add API to get NSURL path without decoding %-escapes


From: Jens Alfke
Subject: [bug #35701] Add API to get NSURL path without decoding %-escapes
Date: Fri, 02 Mar 2012 23:57:11 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.22 (KHTML, like Gecko) Chrome/19.0.1049.3 Safari/535.22

URL:
  <http://savannah.gnu.org/bugs/?35701>

                 Summary: Add API to get NSURL path without decoding %-escapes
                 Project: GNUstep
            Submitted by: snej
            Submitted on: Fri 02 Mar 2012 11:57:10 PM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Change Request
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

GNUstep doesn't have a method equivalent to CFURLCopyPath, which returns the
path portion of a URL *without* decoding %-escapes. This is important if you
need to be able to work with paths that contain quoted slashes, i.e. "%2F"
escapes -- the regular NSURL.path method decodes all the escapes so you can no
longer tell %2F apart from /.

My app needs this functionality. (In the REST API I'm working with, path
components may contain slashes if they are escaped as %2F.) In the original
Mac/iOS code I use CFURLCopyPath, but I couldn't find a good way to do this in
GNUstep. I don't want to bring in the entire CoreBase framework just for that
one function.

Looking at NSURL.m, all I need to to is prevent one call to unescape(). I
added a boolean parameter indicating whether to leave the escapes. So the
existing -path method passes NO, and I created a new -pathWithEscapes method
that passes YES.

Attached is a patch that implements this.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 02 Mar 2012 11:57:10 PM GMT  Name: pathWithEscapes.patch  Size: 2kB 
 By: snej
Patch implementing -[NSURL pathWithEscapes]
<http://savannah.gnu.org/bugs/download.php?file_id=25249>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?35701>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]