Dataset Page: Guest User can't get file info for a deaccessioned dataset #776
Conversation
g-saracca
left a comment
There was a problem hiding this comment.
Hi @ChengShi-1 , some comments here 👍🏼
| /> | ||
|
|
||
| <ShareDatasetButton /> | ||
| {(!isCurrentVersionDeaccessioned || canUpdateDataset) && <ShareDatasetButton />} |
There was a problem hiding this comment.
Is this logic replicating JSF condition?
| new FileDownloadSize(0, FileSizeUnit.BYTES, FileDownloadMode.ORIGINAL), | ||
| new FileDownloadSize(0, FileSizeUnit.BYTES, FileDownloadMode.ARCHIVAL) | ||
| ]) | ||
| }) |
There was a problem hiding this comment.
Why are we deleting the test 'gets the dataset by persistentId when is locked'?
There was a problem hiding this comment.
I wrongly overwrite this test while merging conflict :( I'll recover this
| // If the server returns NOT_FOUND when deaccessioned info isn't included, ignore and continue without sizes. | ||
| return datasetDetails | ||
| } | ||
| throw error |
There was a problem hiding this comment.
I dont understand this, why this checking for 404? Is the description of this PR outdated?
In steves PR I see this comment "guest user should see deaccessioned file count and download size"
There was a problem hiding this comment.
Also you could use JSDataverseReadErrorHandler and don't cast the error error: ReadError, as you could have other many types of errors. Try something like this:
} catch (err: ReadError | unknown) {
if (err instanceof ReadError) {
const error = new JSDataverseReadErrorHandler(err)
const statusCode = error.getStatusCode()
if (statusCode === 404) return datasetDetails
} else if (err instanceof Error && err.message.includes('404')) {
return datasetDetails
} else {
throw error
}
}
There was a problem hiding this comment.
@g-saracca Sorry, the description said it should return 403, but it actually it returns 404.
- For guest users with includeDeaccessioned=false: Returns 404 Not Found
- For guest users with includeDeaccessioned=true: Returns 200 OK with download size.
Also, alternatively, if the dataset is deaccessioned and canEditDataset is false, skip calling the downloadSize endpoints and keep the defaults, avoiding the error path entirely. Do you think it will be better?
There was a problem hiding this comment.
Sorry I still don't understand.
If you are a guest user and do NOT request to include deaccessioned version you will receive a 404, but you will receive a 200 ok being a guest user requesting a deaccessioned version? how can be that way?
I'm lost with this thing sorry 🙏🏼
There was a problem hiding this comment.
Yes, guest user could still access files' downloadSize info for deaccessioned dataset, which will work for a deaccessioned tombstone
Important Note: A tombstone landing page with the basic citation metadata will always be accessible to the public if they use the persistent URL (Handle or DOI) provided in the citation for that dataset. Users will not be able to see any of the files or additional metadata that were previously available prior to deaccession.
There was a problem hiding this comment.
For the backend, the issue was includeDeaccessioned=true, user: guest returns 404, so they fixed, now it returns 200.
In the UI, if we don't skip the 404, the UI will be 404 error page.
The downloadSize is a part of getByPersistentId in datasetJSDataverseRepository, and fileDownloadSizes is a field of the Dataset model. In order to prevent the showing of 404 error page, I catches 404 here.
You should not be sorry, this is truly confusing, I am not sure if I did it right. Thanks for helping!
There was a problem hiding this comment.
Ok I think I understand now, try to use the suggestion I made for catching the error in a more robust way.

What this PR does / why we need it:
download/count and downloadsize will return 404 for user: guests, the getByPersistentId should be refactored to adapt the change
If user:guest and the dataset is deaccessioned:
dataset is ok to show basic info, versions and deaccessioned reason
NO File info could be shown, cannot direct to file page as well
Hide share button
Hide metric(prevent fetching download/count
Which issue(s) this PR closes:
Special notes for your reviewer:
Suggestions on how to test this:
As a guest user, in a dataset, check if the dataset metric component and the Share button is hidden. As a dataset owner, check if the dataset metric component and the Share button is shown.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?:
Additional documentation: