Skip to content

Commit fc771ed

Browse files
author
sp
committed
Fix: Fix GetList for all Px Rest Versions
1 parent dc7c064 commit fc771ed

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

proffixrest/list.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@ func (c *Client) GetList(ctx context.Context, listenr int, body interface{}) (io
1818
logDebug(ctx, c, fmt.Sprintf("Error on create list: %v, PxSession-ID: %v", resp, PxSessionId))
1919
return resp, headers, status, err
2020
}
21-
downloadLocation := headers.Get("Location")
21+
22+
// Build Download Uri - was change in Px Rest-API 4.43 / 4.42. This fix works for all...
23+
dateiNr := ConvertLocationToID(headers)
24+
downloadUri := "PRO/Datei/" + dateiNr
2225

2326
//If Log enabled log URL
24-
logDebug(ctx, c, fmt.Sprintf("Got Download URL from PROFFIX REST-API: %v, PxSession-ID: %v", downloadLocation, PxSessionId))
27+
logDebug(ctx, c, fmt.Sprintf("Got Download URL from PROFFIX REST-API: %v, PxSession-ID: %v", downloadUri, PxSessionId))
2528

26-
downloadFile, headersDownload, statusDownload, err := c.Get(ctx, downloadLocation, nil)
29+
downloadFile, headersDownload, statusDownload, err := c.Get(ctx, downloadUri, nil)
2730

2831
if headersDownload == nil {
2932
headersDownload = http.Header{}
3033
}
3134

3235
//If Log enabled log URL
33-
logDebug(ctx, c, fmt.Sprintf("Downloaded File from '%v' with Content-Length: %v, PxSession-ID: %v", downloadLocation, headersDownload.Get("Content-Length"), PxSessionId))
36+
logDebug(ctx, c, fmt.Sprintf("Downloaded File from '%v' with Content-Length: %v, PxSession-ID: %v", downloadUri, headersDownload.Get("Content-Length"), PxSessionId))
3437

3538
return downloadFile, headersDownload, statusDownload, err
3639

0 commit comments

Comments
 (0)