Closed PhlexPlexico closed 3 years ago
Can you post your code? The only way it appends a trailing slash is if you leave the endpoint
parameter empty, which is not the documented usage.
Ah. That may be the cause and reason why it's happening. I have a general CreateRequest
function here that creates the request:
static HTTPClient CreateRequest(const char[] apiMethod, any:...) {
char url[1024];
Format(url, sizeof(url), "%s%s", g_APIURL, apiMethod);
LogDebug("Our URL is: %s", url);
char formattedUrl[1024];
VFormat(formattedUrl, sizeof(formattedUrl), url, 2);
LogDebug("Trying to create request to url %s", formattedUrl);
HTTPClient req = new HTTPClient(formattedUrl);
if (StrEqual(g_APIKey, "")) {
// Not using a web interface.
return null;
} else if (req == INVALID_HANDLE) {
LogError("Failed to create request to %s", formattedUrl);
return null;
} else {
return req;
}
}
Since the request has the entire URL in it already, the actual request is blank:
req.DownloadFile("", logoPath, LogoCallback);
So I will definitely change this to ensure I at least have a portion of the URL in the endpoint. This is the only time where I really wound up in this situation where it's been causing me grief 😅
Thanks for the quick response!
And looks like that solved my issues, images are being saved to the proper directories. Thank you very much!
Hey!
I'm using this plugin as a way to interact with a webserver. However, I'm trying to download files and realize that I'm hitting a 404 each time I'm trying to download an image. It appears that when it's trying to download, it appends an additional
/
to the end of the image, per my server logs:GET /static/img/logos/RVpYn.png/ 404
Would it be possible to remove this trailing slash when attempting to download files? I realize that this hits every request that's made (I think it's right here?) calls
BuildURL
, however I don't think downloading files really need this trailing slash as it more often than not 404s.