Repository navigation
[dtq-dev-93] Fix 500/400 on share link, ePIC list, featured services, by-handle download and CMDI file links - #1774
Open
milanmajchrak wants to merge 5 commits into
Open
milanmajchrak wants to merge 5 commits into
milanmajchrak wants to merge 5 commits into
Conversation
The token is already saved, so a mail failure is logged and the link is still returned. The new emailSent flag tells the UI whether the mail went out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without lr.pid.service.url, user or pass, the ePIC endpoints answer 404 with a message the admin page shows, and do not call ePIC. Co-Authored-By: Claude Opus 5.5 <[email protected]>
findAll returned null. Featured services come from the configuration per item. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The anonymous download context failed the second READ check, so a user allowed to read a non-public file got 500. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A proxy that rewrites the path decodes it, and Tomcat refuses a bare quote and similar characters. Only such names use ?filename=; all other links stay the same. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
References
No dtq-dev source. The same bugs are on dtq-dev; they are fixed on v9 only.
The FE branch
93/fe-share-link-mail-warningreads the newemailSentflag and shows a warning instead of "sent successfully".Description
Five endpoints answered 500 or 400 where they should work or give a clear error. Now the share link is returned even when the e-mail fails (with
emailSent: false), the ePIC list says it is not configured, the featured services list answers 405, an allowed user can download a non-public file by handle, and CMDI file links survive a quote in the file name.Instructions for Reviewers
List of changes in this PR:
SubmissionController: when the share link e-mail cannot be sent, the error is logged and the link is still returned (was 500, although the token was already saved). The response has a newemailSentfield. It istrueonly when the mail went out, andfalsewhen sending failed or mail is disabled (mail.server.disabled).EpicHandleRestController: iflr.pid.service.url,lr.pid.service.userorlr.pid.service.passis empty, every endpoint answers 404 with a message that names them. The admin page shows the message. Before, the call went out without credentials and ended as 500 "An exception has occurred".ClarinFeaturedServiceRestRepository.findAllreturnednull, so/api/core/featuredservices(listed in the HAL root) gave 500. It now answers 405, like other repositories without a list. The item page does not use it; it reads/api/core/refbox/services, which works.BitstreamByHandleRestControllerstreamed the file through a new, anonymousContext, andretrieve()checked READ again on it. A logged-in user who may read a non-public file got 500 (403 in MockMvc). It now streams with the request context. Anonymous still gets 401, a user without rights 403.lindat_cmdi.xsl: a proxy that rewrites the path (the/repository/deployment) decodes it, so%22reaches Tomcat as a bare quote and it answers 400. Acmd:ResourceRefnow uses/api/core/bitstreams/handle/<handle>?filename=<name>only when the name has one of these characters:" % / ; < > [ \ ] ^ { | }and the backtick. They are the ones that fail behind such a proxy. The query string is passed as is. Links of all other files stay byte for byte the same.SubmissionControllerIT,EpicHandleRestControllerIT,ClarinRefBoxControllerIT,BitstreamByHandleRestControllerITandCmdiDownloadLinkIT.EpicHandleRestControllerITnow sets test credentials and resets the JVM-wideAuthenticatorafter each test.How to test:
mvn verify -pl dspace-server-webapp,dspace -am -DskipIntegrationTests=false -Dtest=none -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -Dit.test=SubmissionControllerIT,EpicHandleRestControllerIT,ClarinRefBoxControllerIT,BitstreamByHandleRestControllerIT,CmdiDownloadLinkIT. All pass. Without the main-code changes the 5 new tests and theemailSentcheck ingenerateShareTokenAndSetOwnerTestfail. The ePIC test also checks that ePIC is never called.emailSent: false./server/api/core/bitstreams/handle/<handle>?filename=<name>. You get the file.a b.txtanda"b.txtwithmetadataPrefix=cmdi. The first keeps the path form, the second gets?filename=. Both download behind/repository/, none gives 400.Codex review (gpt-6.2-sol, high), 2 rounds: 2 findings fixed (
emailSentwas true with mail disabled, the ePIC test could reach the network). The last round found 2 more, not changed: a broken mail template still gives 500, and a config reload during a send can misreportemailSent.Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.🤖 Generated with Claude Code