bugGNUstep - Bugs: bug #35701, Add API to get NSURL path without...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitted by:  Jens Alfke <snej>
Submitted on:  Fri 02 Mar 2012 11:57:10 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: In Test

Thu 08 Mar 2012 04:16:50 AM UTC, comment #2:

Jens, I just wanted to mention that GNUstep has a "work in progress" implementation of CoreFoundation. I did quite some work on CFURL last month and would appreciate help test the results. The library is called "corebase" and is under libs/corebase in the SVN repo. The CFURL implementation does include a CFURLCopyPath() implementation, and as far as know it is compatible with Apple's. CFURLRef is not yet toll-free bridged to NSURL.

Stef <stefanbidi>
Project Member
Wed 07 Mar 2012 08:41:17 AM UTC, comment #1:

Thanks. I applied this patch but with a small change ... you missed implementing the new method in Source/Additions/NSURL+GNUstepBase.m

But ... I have zero experience using core foundation (and don't generally do any osx coding), so my attempt to implement the missing method is almost certainly wrong ... please could you check/correct as necessary.

Richard Frith-Macdonald <CaS>
Project Member
Fri 02 Mar 2012 11:57:10 PM UTC, original submission:

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.

Jens Alfke <snej>

 

Attached Files
file #25249:  pathWithEscapes.patch added by snej (2KiB - application/octet-stream - Patch implementing -[NSURL pathWithEscapes])

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by stefanbidi (Posted a comment)
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by snej (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 07 Mar 2012 08:41:17 AM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>In Test
    Fri 02 Mar 2012 11:57:10 PM UTCsnejAttached File-=>Added pathWithEscapes.patch, #25249

    Back to the top


    Powered by Savane 3.1-cleanup1