Skip to content

Commit 1e7e075

Browse files
committed
Fix schemaLocation dereferencing of relative path
1 parent d6db7a1 commit 1e7e075

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

gowsdl.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,18 @@ func (g *GoWSDL) resolveXSDExternals(schema *XSDSchema, u *url.URL) error {
199199
return nil
200200
}
201201

202-
schemaLocation := location.String()
203202
if !location.IsAbs() {
204203
if !u1.IsAbs() {
205-
return fmt.Errorf("Unable to resolve external schema %s through WSDL URL %s", schemaLocation, u1)
204+
return fmt.Errorf("Unable to resolve external schema %s through WSDL URL %s", location.String(), u1)
205+
}
206+
if location, err = url.Parse(u1.Scheme + "://" + u1.Host + location.String()); err != nil {
207+
return err
206208
}
207-
schemaLocation = u1.Scheme + "://" + u1.Host + schemaLocation
208209
}
209210

210-
log.Println("Downloading external schema", "location", schemaLocation)
211+
log.Println("Downloading external schema", "location", location.String())
211212

212-
data, err := downloadFile(schemaLocation, g.ignoreTLS)
213+
data, err := downloadFile(location.String(), g.ignoreTLS)
213214
if err != nil {
214215
return err
215216
}
@@ -225,8 +226,7 @@ func (g *GoWSDL) resolveXSDExternals(schema *XSDSchema, u *url.URL) error {
225226
maxRecursion > g.currentRecursionLevel {
226227
g.currentRecursionLevel++
227228

228-
// log.Printf("Entering recursion %d\n", g.currentRecursionLevel)
229-
err = g.resolveXSDExternals(newschema, u1)
229+
err = g.resolveXSDExternals(newschema, location)
230230
if err != nil {
231231
return err
232232
}

0 commit comments

Comments
 (0)