urllib: a temporary autofree fix
parent
0823ea4af1
commit
77d5fcca59
|
@ -604,10 +604,18 @@ fn (s string) substr2(start int, _end int, end_max bool) string {
|
|||
// Example: assert 'ABCD'.substr(1,3) == 'BC'
|
||||
pub fn (s string) substr(start int, end int) string {
|
||||
$if !no_bounds_checking ? {
|
||||
/*
|
||||
$if debug {
|
||||
if start > end || start > s.len || end > s.len || start < 0 || end < 0 {
|
||||
panic('substr($start, $end) out of bounds (len=$s.len)')
|
||||
println('substr($start, $end) out of bounds (len=$s.len)')
|
||||
println('s="$s"')
|
||||
print_backtrace()
|
||||
return ''
|
||||
}
|
||||
}
|
||||
*/
|
||||
panic('substr($start, $end) out of bounds (len=$s.len)')
|
||||
}
|
||||
len := end - start
|
||||
if len == s.len {
|
||||
return s.clone()
|
||||
|
|
|
@ -745,10 +745,14 @@ pub fn (u URL) str() string {
|
|||
// preceded by a dot-segment (e.g., './this:that') to make a relative-
|
||||
// path reference.
|
||||
i := path.index_byte(`:`)
|
||||
if i > -1 {
|
||||
// TODO remove this when autofree handles tmp
|
||||
// expressions like this
|
||||
if i > -1 && path[..i].index_byte(`/`) == -1 {
|
||||
buf.write_string('./')
|
||||
}
|
||||
}
|
||||
}
|
||||
buf.write_string(path)
|
||||
}
|
||||
if u.force_query || u.raw_query != '' {
|
||||
|
|
Loading…
Reference in New Issue