Forum OpenACS Development: Strip domain from URL

Collapse
Posted by Iuri Sampaio on
Hi there,

I've noticed there's no ad_proc to strip the domain part of an URL string. Is there any?

If not, I believe we should add something like that into core's utilities-procs.tcl

I know it's a very simple proc, but it saves developer's time and effort, parsing the string, or even thinking about it.

Best wishes,

For example:

    set l_url [split $url "/"]
    set uplaod_file ""
    for {set i 3} {$i < [llength $l_url]} {incr i} {
        append upload_file  "/[lindex $url $i]"
    }
Collapse
2: Re: Strip domain from URL (response to 1)
Posted by Gustaf Neumann on
NaviServer contains an API function called ns_parseurl [1] for its internally used function for parsing URLs (used in AOLserver and NaviServer). acs-tcl contains a compatibility proc for installations using still AOLserver.

[1] https://naviserver.sourceforge.io/n/naviserver/files/ns_parseurl.html