Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: clean-path

From: allenk:powerup:au at: 5-Dec-2000 22:56

Trawling through my archives I found this one from Bo. Hope its useful.. REBOL [ Title: "Clean HTTP path" Date: 16-Sep-1999 Author: "Bohdan Lechnowsky" Email: [bo--rebol--com] File: %cleanhttp.r Purpose: { To remove /../ from within HTTP URLs. Will remove parent directories for each /../ encountered, but will not remove site information. } ] clean-parents: func [url][ url: parse url "/" forall url [ while [url/1 = ".."] [ either (index? url) <= 4 [ remove url ][ remove/part back url 2 url: back url ] ] ] to-url join "http" to-url remove head url ] Cheers, Allen K