DataONEorg / rdataone

R package for reading and writing data at DataONE data repositories
http://doi.org/10.5063/F1M61H5X
36 stars 19 forks source link

Issue with getChecksum for private data package #262

Closed eblondel closed 3 years ago

eblondel commented 3 years ago

Hello,

Thanks for this great package. I'm currently trying it to insert/update cycles over data packages, and at some point I moved out from the CRAN version to install the current Github dev version.

I've tried to apply getDataPackage method, but for the data resource attached to it, I got this error:

Error in checksum$.attrs[["algorithm"]] : subscript out of bounds

Digging into the R code, i've identified this comes from the getChecksum function. For some unknown reason, I get an unauthorized GET request, which makes code break at https://github.com/DataONEorg/rdataone/blob/master/R/MNode.R#L307

My checksum object returned at line 304 looks like that:

$description
[1] "READ not allowed on urn:uuid:f806756e-0fa3-11eb-a2e5-e5e202a27544 for subject[s]: public; "

$.attrs
     detailCode       errorCode            name 
         "1820"           "401" "NotAuthorized" 

I've then realized this was because the data package was set as private, and the getChecksum is always done without authorization. Shouldn't it use auth_get instead native httr::GET ? so we can allow getting private data packages?

mbjones commented 3 years ago

@eblondel this looks like a bug in error handling to me, so I will target it at the next release if we can reproduce it (help on a short reprex would be useful. If we can't quickly reproduce it, we'll probably retarget it to 2.3.0.

gothub commented 3 years ago

Thanks @eblondel for flagging this issue, and for providing the solution.

This problem has been resolved, such that authorized users can retrieve checksums for private content.

Fixed in commit https://github.com/DataONEorg/rdataone/commit/5ad2b7df2eebf106c5ff17a42c2823b7eb66a5d4

CDorich commented 3 years ago

I've tried unsubscribing from this list a few time, but keep getting the email. Can you unsubscribe me?

-Chris


From: Peter Slaughter notifications@github.com Sent: Tuesday, November 24, 2020 2:28 PM To: DataONEorg/rdataone rdataone@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [DataONEorg/rdataone] Issue with getChecksum for private data package (#262)

Closed #262https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDataONEorg%2Frdataone%2Fissues%2F262&data=04%7C01%7Cchris.dorich%40colostate.edu%7C6a2f66fe8027416aa7c108d890bfef7a%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637418501325415764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=URpGi2ArFwIYHbl8f2ZYsigvX9q8UrIZ9MH%2Fbw6uMRI%3D&reserved=0.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDataONEorg%2Frdataone%2Fissues%2F262%23event-4034889185&data=04%7C01%7Cchris.dorich%40colostate.edu%7C6a2f66fe8027416aa7c108d890bfef7a%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637418501325415764%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=1743Y%2FD%2B5CMNJk8nI7%2F1qlWjiWuudy9GATugYj31sng%3D&reserved=0, or unsubscribehttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAHAECIUCJTL3IMBRUEIGRG3SRQQRDANCNFSM4STKEGLQ&data=04%7C01%7Cchris.dorich%40colostate.edu%7C6a2f66fe8027416aa7c108d890bfef7a%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637418501325425758%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ZRoujTrTnUYYsvvJI88Wv%2FrrW5ltd5wttymphSkX6to%3D&reserved=0.

mbjones commented 3 years ago

@CDorich we can not, only you can. The overall email notification settings are controlled in your github account settings. And the repository-specific settings are controlled via the Watch button at the top of each repository page. Details of unsubscribing are in the GitHub docs: https://docs.github.com/en/free-pro-team@latest/github/managing-subscriptions-and-notifications-on-github/managing-your-subscriptions

eblondel commented 3 years ago

Many thanks @gothub and @mbjones for this prompt fix, much appreciated!