Skip to content

Allow Preview User to download files without requiring a Guestbook Re…#12548

Open
stevenwinship wants to merge 4 commits into
developfrom
12535-download-without-guestbook-response-for-preview-user
Open

Allow Preview User to download files without requiring a Guestbook Re…#12548
stevenwinship wants to merge 4 commits into
developfrom
12535-download-without-guestbook-response-for-preview-user

Conversation

@stevenwinship

Copy link
Copy Markdown
Contributor

The guestbook popup does not appear to collect a response before the download attempt is made. Disabling the guestbook on the dataset resolves the issue and files download normally through the Preview URL. This fix reinstates the behavior of the JSF UI from prior versions of Dataverse.

Which issue(s) this PR closes:#12535

Special notes for your reviewer:

Suggestions on how to test this: Create a dataset with a guestbook. Generate a Preview URL. Using the preview url try to download files and dataset zip file. This should work without requiring the guestbook response.

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:

@stevenwinship stevenwinship self-assigned this Jul 21, 2026
@github-actions github-actions Bot added FY27 Sprint 1 FY27 Sprint 1 (2026-07-01 - 2026-07-15) FY27 Sprint 2 FY27 Sprint 2 (2026-07-15 - 2026-07-29) Original size: 20 Type: Bug a defect labels Jul 21, 2026
@stevenwinship stevenwinship moved this to In Progress 💻 in IQSS Dataverse Project Jul 21, 2026
@stevenwinship stevenwinship modified the milestones: 6.12, 6.11.1 Jul 21, 2026
@coveralls

coveralls commented Jul 21, 2026

Copy link
Copy Markdown

Coverage Status

Coverage is 24.971%12535-download-without-guestbook-response-for-preview-user into develop. No base build found for develop.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Test Results

403 tests  ±0   388 ✅ ±0   33m 54s ⏱️ -1s
 55 suites ±0    15 💤 ±0 
 55 files   ±0     0 ❌ ±0 

Results for commit 092ef3e. ± Comparison against base commit 72a5ad2.

♻️ This comment has been updated with latest results.

@stevenwinship stevenwinship moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Jul 22, 2026
@stevenwinship stevenwinship removed their assignment Jul 22, 2026
@github-actions

This comment has been minimized.

@stevenwinship
stevenwinship force-pushed the 12535-download-without-guestbook-response-for-preview-user branch from bdf4a83 to 1511464 Compare July 22, 2026 15:33
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@qqmyers qqmyers moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jul 22, 2026
@qqmyers qqmyers self-assigned this Jul 22, 2026

@qqmyers qqmyers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it would work, except for some minor URL tweaking, but it seems like the fixes are in one-off places rather than the way things are done for other types of users. I made some comments about moving things around and avoiding a new method using signing.

} else {
logger.fine("Redirecting to file download url: " + fileDownloadUrl);
try {
// Sign URL for preview url user

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you set the token in the PrivateUrlUser, is there any reason you can't generate the required signed URL in the same method, e.g.

private Response returnSignedUrl(ContainerRequestContext crc, UriInfo uriInfo, User user, String id, String gbrids) {
// Create the signed URL
String userIdentifier = null;
String key = null;
if (user != null && user instanceof AuthenticatedUser) {
AuthenticatedUser requestor = (AuthenticatedUser) user;
userIdentifier = requestor.getUserIdentifier();
// Find the latest token: Use for signing
// Could be null if no token was generated: Generate one to be used for signing (expire in 1 minute to match timeout in signedUrl)
// Could be expired: The user was already authenticated (possible by bearer token). Only used for signing so we don't care
ApiToken apiToken = authSvc.findApiTokenByUser(requestor);
if (apiToken == null) {
logger.fine("Generating temporary API token for user " + userIdentifier);
apiToken = authSvc.generateApiTokenForUser(requestor, AuthenticationServiceBean.INTERVAL.MINUTES, GUESTBOOK_RESPONSE_SIGNEDURL_TIMEOUT_MINUTES);
}
if (apiToken != null) {
key = apiToken.getTokenString();
}
} else {
// Guest
userIdentifier = "guest";
// Note: In order for the key to match we need to replace ":persistentId" with the actual file id since that is what will be sent in via the signed url.
key = URLDecoder.decode(uriInfo.getAbsolutePath().toASCIIString())
.replace(":persistentId", id); //TODO find a better one for here and in SignedUrlAuthMechanism.java
}
? (If not the URL munging here has to change as localhost:8080 won't work.)

@@ -0,0 +1,2 @@
## Bug ##
Preview Users can now download files without the required guestbook response.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preview URL users could not download files from the dataset being previewed if a guestbook was assigned to that dataset. This is now fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}
if(!sessionUserCanViewUnpublishedDataset){
//Only Reset if user cannot view this Draft Version
privateUrlUser.setToken(token);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be cleaner to set this in

public PrivateUrlUser getPrivateUrlUserFromToken(String token) {
return PrivateUrlUtil.getPrivateUrlUserFromRoleAssignment(getRoleAssignmentFromPrivateUrlToken(token));
}
- when the token lookup is done?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

Copy link
Copy Markdown

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:12535-download-without-guestbook-response-for-preview-user
ghcr.io/gdcc/configbaker:12535-download-without-guestbook-response-for-preview-user

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY27 Sprint 1 FY27 Sprint 1 (2026-07-01 - 2026-07-15) FY27 Sprint 2 FY27 Sprint 2 (2026-07-15 - 2026-07-29) Original size: 20 Type: Bug a defect

Projects

Status: In Review 🔎

Development

Successfully merging this pull request may close these issues.

When there is a guestbook, you cannot download files using a Preview URL

3 participants