• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Weird behavior of -URLByAppendingPathComponent:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird behavior of -URLByAppendingPathComponent:


  • Subject: Re: Weird behavior of -URLByAppendingPathComponent:
  • From: Nathan Sims <email@hidden>
  • Date: Mon, 20 Jun 2011 10:37:39 -0700

FWIW, the standard (can't remember which RFC I saw this in) is for treating a double slash // (or any number of slashes) as a single slash / in URLs (after the initial http://).


On Jun 19, 2011, at 9:14 PM, Jens Alfke wrote:

> Something seems wrong with -[NSURL URLByAppendingPathComponent:] --
>
> (gdb) po baseURL
> http://127.0.0.1:5984/
> (gdb) po [baseURL URLByAppendingPathComponent: @"foo"]
> http://127.0.0.1:5984/foo
> (gdb) po [baseURL URLByAppendingPathComponent: @"foo/"]
> http://127.0.0.1:5984/foo//
>
> Why the doubled slash at the end, in the third result? There should only be one. I’m not sure if doubled slashes are actually illegal in URL paths, but they’re certainly weird, and I’m pretty sure they’d confuse a lot of websites. I’m guessing this is a CF bug.
>
> [This is on OS X 10.6.7.]
>
> And yes, I know about +URLWithString:relativeToURL: … but that method doesn’t do the same thing. It only appends the string if the original URL ends with a “/“, otherwise it replaces the last path component. (Which is correct behavior for interpreting relative paths, just not what I want.)
>
> —Jens_______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Weird behavior of -URLByAppendingPathComponent: (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: If No Memory Leaks, Is It Good Enough for Memory Management?
  • Next by Date: Re: Progress Indicators Spin vs Bar
  • Previous by thread: Re: Weird behavior of -URLByAppendingPathComponent:
  • Next by thread: NSArrayController loses selection upon CoreData refreshObject.
  • Index(es):
    • Date
    • Thread