Repository navigation
Fixing external tools with guestbook responses - #12801
stevenwinship wants to merge 11 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Could you please sync the branch up with develop. |
|
@stevenwinship decoded: This in turn produces an /access url without the gbrid, which bombs with a 400. Please advise. |
86741c7 to
fea5d34
Compare
This comment has been minimized.
This comment has been minimized.
|
Did you install your own external tool? If so did you include "gbrecs=false" or "gbrecs=true" in the allowedapicalls? This is what it looks for to add the gb response id. I'll look into changing it so it gets added either way [{"name":"retrieveFileContents","httpMethod":"GET","urlTemplate":"/api/v1/access/datafile/{fileId}?gbrecs=true","timeOut":3600},{"name":"downloadFile","httpMethod":"GET","urlTemplate":"/api/v1/access/datafile/{fileId}?gbrecs=false","timeOut":3600},{"name":"getDatasetVersionMetadata","httpMethod":"GET","urlTemplate":"/api/v1/datasets/{datasetId}/versions/{datasetVersion}","timeOut":3600}] |
|
I installed the tool using the standard command as published. Which in my case was: seems to be the same - i.e.,
|
|
Do I need to re-test, with your latest commits from 1 hour ago? Or are these the same initial commits from force-pushing the branch? I'm getting errors/warning from |
|
... otherwise I can report another issue that I may be seeing. |
|
My latest commit was just a merge from develop |
|
I figured; but they are showing as new commits this am, above. I'm assuming because of a force-push? Since we do want/need to have the |
|
FWIW: ignoring when a gb is assigned, gbrecs determines whether an entry is made that signifies a download, so the main preview needs/needed true to avoid the API writing a download count. At some point, we decided that a preview is close enough to a download that we want to ask the guestbook questions, but I don't think we ever decided that, in the no guestbook case, previews should count as downloads. |
|
In other words, I was wrong above - in that On a side note, I'm not seeing either
|
Of course; I misread the code in Access.java earlier. |
|
I've been trying to reproduce your (@landreev) error using both .wav and .mpeg files. I am getting the dialog to enter the gb info and then I get the download to happen correctly with the id {"name":"downloadFile","httpMethod":"GET","urlTemplate":"/api/v1/access/datafile/{fileId}?gbrecs=true&gbrids=4","timeOut":3600}, Note: I can preview the wav file but I don't see the "eye" with the mpeg |
This comment has been minimized.
This comment has been minimized.
|
With this latest commit the url given to the external tool for download purposes will expire in 60 minutes. The signed url still retains the timeout from the tools configuration but it will not be honored beyond the 60 minutes. The external tool download will still create "Explore" and "View Image" guestbook responses (when clicking preview(EYE) and "Open in new window") but will not generate the "Download" response. EDIT: I don't think the "View Image" matters. Seems it's just the name of the previewer. So it doesn't seem to have a negative effect on the download count. |
|
Sorry for the delay. Re-testing and looking at the code now; especially interested r/n in what I can get away with as a guest user. |
|
The previewers are now working on files w/ explicit guestbooks, for an hour, as planned. I also have an observation that I want to document, will do separately. |
|
|
||
| // Process the guestbook response from JSON and return a signedUrl to the matching GET call | ||
| private Response processDatafilesWithGuestbookResponse(ContainerRequestContext crc, DataverseRequest req, HttpHeaders headers, List<String> fileIdsList, UriInfo uriInfo, boolean gbrecs, String jsonBody) { | ||
| private Response processDatafilesWithGuestbookResponse(ContainerRequestContext crc, DataverseRequest req, HttpHeaders headers, List<String> fileIdsList, UriInfo uriInfo, boolean gbrecs, Long externalToolId, String jsonBody) { |
There was a problem hiding this comment.
What is the bot complaining about here, the "Cognitive Complexity" business - does it have any merit?
There was a problem hiding this comment.
I removed 1 of the unused method params. I don't know who decided that 15 was a limit. I'm not removing what's needed or creating a class to pass multiple values.
08c82e7 to
556a1be
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
I'd like to make an effort and merge this PR asap.
|
|
(Sorry if you are still working on it - I didn't see your name assigned and assumed it was ready for retesting) |
| export TOOL_ID=3 | ||
|
|
||
| curl -H "X-Dataverse-key:$API_TOKEN" -X POST "$SERVER_URL/api/files/$FILE_ID/externalTool/$TOOL_ID/toolUrl" \ | ||
| curl -H "X-Dataverse-key:$API_TOKEN" -X POST "$SERVER_URL/api/files/$FILE_ID/externalTool/$TOOL_ID/toolUrl \ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |


What this PR does / why we need it: External tools can't download files that require/have a guestbook response
Which issue(s) this PR closes:#12760
Special notes for your reviewer:
Suggestions on how to test this: Create a dataset with multiple files to preview. Add a guestbook to the dataset and publish. Test previewing the files and download from the external tool. Test files with restricted access.
Download timeout comes from the external tool params. Try creating an external tool with a 1 minute timeout and make sure the signed url expires.
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?: included
Additional documentation: