Closed SteveViss closed 1 year ago
I will investigate furthermore, let me know if you can reproduce it.
Same here.
Yes I can reproduce! I'll take a look on Friday :)
Another day, another example of R 's double pain of lack of type safety and terrible error messages biting us in the rear.
This seems to happen when the url hits a 301 moved permanently response code:
1] "HTTP/1.1 301 Moved Permanently\r\n"
[2] "Server: Microsoft-Azure-Application-Gateway/v2\r\n"
[3] "Date: Fri, 18 Nov 2022 15:07:52 GMT\r\n"
[4] "Content-Type: text/html\r\n"
[5] "Content-Length: 195\r\n"
[6] "Connection: keep-alive\r\n"
[7] "Location: https://data.ec.gc.ca/data/species/assess/atlas-of-seabirds-at-sea-in-eastern-canada-2006-2016\r\n"
[8] "\r\n"
[9] "HTTP/1.1 200 OK\r\n"
[10] "Date: Fri, 18 Nov 2022 15:07:53 GMT\r\n"
[11] "Content-Type: text/html\r\n"
[12] "Content-Length: 3058\r\n"
[13] "Connection: keep-alive\r\n"
[14] "Cache-Control: public, must-revalidate, max-age=30\r\n"
[15] "Last-Modified: Wed, 15 Dec 2021 17:10:02 GMT\r\n"
[16] "Accept-Ranges: bytes\r\n"
[17] "ETag: \"63241143\"\r\n"
[18] "Strict-Transport-Security: max-age=31536000; includeSubDomains\r\n"
[19] "Referrer-Policy: same-origin\r\n"
[20] "X-Content-Type-Options: nosniff\r\n"
[21] "X-XSS-Protection: 1; mode=block\r\n"
[22] "X-DNS-Prefetch-Control: off\r\n"
[23] "\r\n"
attr(,"status")
[1] 200
The following line in the call to get_remote_file_size
:
tmp <- as.numeric(
gsub("\\D", "", hdr[grepl("^Content-Length:", hdr)])
)
ends up grepping two elements instead of one (one is the expected behavior):
Browse[1]> tmp
[1] 195 3058
then the next call to format
breaks, sending an unhelpful error message. This breaks the parent call to msgDownload
.
@KevCaz do you agree that the "true" file size should be the second one in such example? In which case we can make sure to only pass the last element when tmp
is longer than one.
@SteveViss Can you confirm it all works well for you when you install from the PR #20 ? I made it work on my machine with that fix
@VLucet it works ! Thanks for taking the time on this!
Hi,
Does someone is able to reproduce the following issue retrieving the uuid
f612e2b4-5c67-46dc-9a84-1154c649ab4e
?Gave me the following error:
Seems that all identified resources has a size: 0 bytes, which broke the underlying operations. Traceback
Environment